A very serious error of working with C#-windows has been detected. If you move C#-window continuously, Terminal disappears from the screen after a few seconds, and the CPU-core load of terminal64.exe exceeds 100%. I have 8 cores, so the full core load in TaskManager at CPU is 12-13%. When the C#-window is moving, it is 19%.
Oh, that's cool. Tried it - it really disappears. Or rather, it doesn't disappear, but minimises to the tray, as if you pressed the "minimise" button.
As for 100% loading - I don't see it. Perhaps it's because you have it built in and I don't.
Removing GuiControllerElementsDemo manually through the Terminal menu leads to freezing for a few seconds.
There is such a thing. It happens only if the form is not closed manually beforehand. I don't know how to get round it yet. I tried to close the form in Deinit() in several ways, but none of them worked. If anyone knows how to do it, I will be grateful.
There's this. It happens only if you don't close the form manually beforehand. I don't know how to get around it yet. I tried several ways of extinguishing the form in Deinit(), but none of them worked. If anyone knows how to do it, I will be grateful.
why the standard handler private void Form2_FormClosing(object sender, FormClosingEventArgs e)
doesn't want to work?
when I was experimenting with dll an C#, for some reason everything crashed on exit because I didn't destroy the created components outside the form itself, that's how it was:
Oh, cool. I tried it and it does disappear. Or rather, it doesn't disappear, but minimises to the tray, as if the "minimise" button was pressed.
I tried to move the Terminal window itself (C# is not running). In about 10 seconds absolutely all windows (ME, browsers, etc.) minimised, leaving the desktop bare.
As for 100% loading - I don't see it. Perhaps it is really because you have it built in and I do not.
and why the standard handler private void Form2_FormClosing(object sender, FormClosingEventArgs e)
doesn't want to work?
when I was experimenting with dll an C#, for some reason everything crashed on exit because I didn't destroy the created components outside the form itself, that's how it was:
If I didn't destroy before closing the form from MQL, it slowed down terribly or crashed.
I tried to do through the standard form.Dispose(). That is, when GuiController::HideForm() is called, Dispose of the corresponding form is called. Everything worked fine in the test application in C#. But it doesn't work in MT. But if we close the form manually before deleting the Expert Advisor, everything works fine.
I tried to do it through the standard form.Dispose(). That is, when GuiController::HideForm() is called, the Dispose of the corresponding form is called. Everything worked fine in the test application in C#. But it doesn't work in MT. But if we close the form manually before deleting the Expert Advisor, everything works fine.
I tried to do it through the standard form.Dispose(). That is, when GuiController::HideForm() is called, the Dispose of the corresponding form is called. Everything worked fine in the test application in C#. But it doesn't work in MT. But if we close the form manually before deleting the Expert Advisor, everything works fine.
You should definitely google it, some process is hanging around.
Alternatively, you still need to call Form.Close() for Windows to close the application.
Not calling Close probably bypasses sending a bunch of Win32 messages which one would think are somewhat important though I couldn't specifically tell you why...
Close has the benefit of raising events (that can be cancelled) such that an outsider (to the form) could watch for FormClosing and FormClosed in order to react accordingly.
I'm not clear whether FormClosing and/or FormClosed are raised if you simply dispose the form but I'll leave that to you to experiment with.
Vasiliy Sokolov:
Yes, I have seen your panel. What function do you use to unload?
when calling .dll I create 2 threads and run each form in them via ShowDialog(), kill the forms by trivial call of Close() method and release memory just in case - I don't know how the rubbish collector works in .Net )))))
public static class FormsMT5
{
private static Form1 MainForm;
private static Form2 OrderForm;
private static Thread ThreadMainform, ThreadOrderForm;
....................
publicstaticvoid FormDeinit(int reason)
{
if (reason == 3 || reason == 5) return;
if (MainForm != null)
{
MainForm.Close();
}
if (OrderForm != null)
{
OrderForm.Close();
}
if (ThreadMainform != null) ThreadMainform.Join();
if (ThreadOrderForm != null) ThreadOrderForm.Join();
MainForm = null;
OrderForm = null;
ThreadMainform = null;
ThreadOrderForm = null;
}
I am new to C#, and I tried to look at the earlier posts but did not find a good answer. In a C# Windows Form Application with a single form, is using better or ? MSDN says that all resources within the object are closed and the form is disposed when...
A very serious error of working with C#-windows has been detected. If you move C#-window continuously, Terminal disappears from the screen after a few seconds, and the CPU-core load of terminal64.exe exceeds 100%. I have 8 cores, so the full core load in TaskManager at CPU is 12-13%. When the C#-window is moving, it is 19%.
Oh, that's cool. Tried it - it really disappears. Or rather, it doesn't disappear, but minimises to the tray, as if you pressed the "minimise" button.
As for 100% loading - I don't see it. Perhaps it's because you have it built in and I don't.
Removing GuiControllerElementsDemo manually through the Terminal menu leads to freezing for a few seconds.
There is such a thing. It happens only if the form is not closed manually beforehand. I don't know how to get round it yet. I tried to close the form in Deinit() in several ways, but none of them worked. If anyone knows how to do it, I will be grateful.
There's this. It happens only if you don't close the form manually beforehand. I don't know how to get around it yet. I tried several ways of extinguishing the form in Deinit(), but none of them worked. If anyone knows how to do it, I will be grateful.
why the standard handler private void Form2_FormClosing(object sender, FormClosingEventArgs e)
doesn't want to work?
when I was experimenting with dll an C#, for some reason everything crashed on exit because I didn't destroy the created components outside the form itself, that's how it was:
if I didn't destroy before closing the form from MQL - it slowed down terribly or crashed.
Oh, cool. I tried it and it does disappear. Or rather, it doesn't disappear, but minimises to the tray, as if the "minimise" button was pressed.
I tried to move the Terminal window itself (C# is not running). In about 10 seconds absolutely all windows (ME, browsers, etc.) minimised, leaving the desktop bare.
As for 100% loading - I don't see it. Perhaps it is really because you have it built in and I do not.
At the same time I monitored the execution of the Expert Advisor. Here is the result
You can clearly see that the Expert Advisor stopped its work while the Terminal window was moving.
At the same time I monitored the execution of the Expert Advisor. Here is the result
You can clearly see that the Expert Advisor stopped its work while the Terminal window was moving.
I made a check through the timer - I do not see any hangs. It sends everything to the log very quickly.
and why the standard handler private void Form2_FormClosing(object sender, FormClosingEventArgs e)
doesn't want to work?
when I was experimenting with dll an C#, for some reason everything crashed on exit because I didn't destroy the created components outside the form itself, that's how it was:
If I didn't destroy before closing the form from MQL, it slowed down terribly or crashed.
I tried to do through the standard form.Dispose(). That is, when GuiController::HideForm() is called, Dispose of the corresponding form is called. Everything worked fine in the test application in C#. But it doesn't work in MT. But if we close the form manually before deleting the Expert Advisor, everything works fine.
I tried to do it through the standard form.Dispose(). That is, when GuiController::HideForm() is called, the Dispose of the corresponding form is called. Everything worked fine in the test application in C#. But it doesn't work in MT. But if we close the form manually before deleting the Expert Advisor, everything works fine.
Here it is unloaded instantly.
It unloads instantlyhere.
Yes, I've seen your panel. What function do you use to unload?
I tried to do it through the standard form.Dispose(). That is, when GuiController::HideForm() is called, the Dispose of the corresponding form is called. Everything worked fine in the test application in C#. But it doesn't work in MT. But if we close the form manually before deleting the Expert Advisor, everything works fine.
You should definitely google it, some process is hanging around.
Alternatively, you still need to call Form.Close() for Windows to close the application.
https://stackoverflow.com/questions/3097364/c-sharp-form-close-vs-form-dispose
Not calling Close probably bypasses sending a bunch of Win32 messages which one would think are somewhat important though I couldn't specifically tell you why...
Close has the benefit of raising events (that can be cancelled) such that an outsider (to the form) could watch for FormClosing and FormClosed in order to react accordingly.
I'm not clear whether FormClosing and/or FormClosed are raised if you simply dispose the form but I'll leave that to you to experiment with.
Yes, I have seen your panel. What function do you use to unload?
public static class FormsMT5 { private static Form1 MainForm; private static Form2 OrderForm; private static Thread ThreadMainform, ThreadOrderForm; .................... public static void FormDeinit(int reason) { if (reason == 3 || reason == 5) return; if (MainForm != null) { MainForm.Close(); } if (OrderForm != null) { OrderForm.Close(); } if (ThreadMainform != null) ThreadMainform.Join(); if (ThreadOrderForm != null) ThreadOrderForm.Join(); MainForm = null; OrderForm = null; ThreadMainform = null; ThreadOrderForm = null; }Yes, I've seen your panel. What function do you use to unload?
That's Igor's panel. I just published it.