I want to trigger the chart (window) from a DLL (DLL starts separate thread with WinAPI CreateThread).
In MT4, I simply trigger the EA resp. Indi. with a tick sent with message "MT4 Internal Message". For this, I need the
Window Handle HWND. I obtain the Handle with MT4-Function WindowHandle(Symbol, timeframe). This is a "real" Window
Handle. It can be used with the Windows API and addresses exactly the MDI-Window of the Chart.
How can I do the same things in MT5/MQL5? If it is not implemented, how can it be patched?
Furthermore, I am not sure that MT5 ChartGetInteger ./.Chart_Window_Handle delivers the "right" HWND of the window.
I fear this HWND is rather an "Internal MT5 Handle". (therefore useless for WinAPI).
Thanks!
Hi RCMAD,
I check the parents of ChartGetInteger' CHART_WINDOW_HANDLE and use WinAPI CloseWindow to close the chart - works for me.
I haven't further check with other Win API though :).
BTW, what do you want to create that needed chart handle so bad ?
- www.mql5.com
Hi RCMAD,
I check the parents of ChartGetInteger' CHART_WINDOW_HANDLE and use WinAPI CloseWindow to close the chart - works for me.
I haven't further check with other Win API though :).
BTW, what do you want to create that needed chart handle so bad ?
I have to blame myself.... I'm so sorry.
Yes, HWND definitely works, with GetParent and SetWindowText I could change the title of the window. Even the
SendMessage stuff works , both with user32dll and my testdll.
Why I want the chart handle so bad? e.g. now I can write a timer with arbitrarily short intervals ,e.g. 100 milliseconds, and send
timer-ticks to different charts. And I can set up my own window and synchronize with an EA. IMHO, the "best control" of Windows/ WinAPI
is the TreeView-Control. This is not implemented in MQL5.
I have to blame myself.... I'm so sorry.
Yes, HWND definitely works, with GetParent and SetWindowText I could change the title of the window. Even the
SendMessage stuff works , both with user32dll and my testdll.
Why I want the chart handle so bad? e.g. now I can write a timer with arbitrarily short intervals ,e.g. 100 milliseconds, and send
timer-ticks to different charts. And I can set up my own window and synchronize with an EA. IMHO, the "best control" of Windows/ WinAPI
is the TreeView-Control. This is not implemented in MQL5.
Hi RCMAD,
Just an idea, if it is EA or script and not CI, why not using while loop ?. AFAIK it not really burden the processor.
while(!IsStopped()) { // here the main code int slept = 100; // here we can vary the slept value Sleep (slept); }
Then again that is your idea and your code , and not mine, so you can mind mine if you disagree :)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I want to trigger the chart (window) from a DLL (DLL starts separate thread with WinAPI CreateThread).
In MT4, I simply trigger the EA resp. Indi. with a tick sent with message "MT4 Internal Message". For this, I need the
Window Handle HWND. I obtain the Handle with MT4-Function WindowHandle(Symbol, timeframe). This is a "real" Window
Handle. It can be used with the Windows API and addresses exactly the MDI-Window of the Chart.
How can I do the same things in MT5/MQL5? If it is not implemented, how can it be patched?
Furthermore, I am not sure that MT5 ChartGetInteger ./.Chart_Window_Handle delivers the "right" HWND of the window.
I fear this HWND is rather an "Internal MT5 Handle". (therefore useless for WinAPI).
Thanks!