Download MetaTrader 5

How can I get windows handle of currently active(focused) chart?

To add comments, please log in or register
Kashif Javed
1218
Kashif Javed  
Let suppose that 2 terminals are running in my system and each terminal has few opened charts. My question is that if there is any way to get the window handle of the chart which is currently active using any mql function or system DLL?
Demos Stogios
188
Demos Stogios  

If you want the current chart, there is the function WindowHandle() from MQL and you may find some other, probably usefull functions in the "Chart Operations" part in the documentation. But I am confused if you want to know also which of the two terminals is active in your machine; in that case, that topic may help you to some extent https://www.mql5.com/en/forum/139341 

 

best regards 

okwh
1633
okwh  
Kashif Javed
1218
Kashif Javed  
I know about WindowHandle() but I asked that I want to know Handle for currently focused/Active chart. WindowHandle() returns only chart handle in which EA is running. Let suppose that I clicks on EURUSD chart window that means now EURUSD chart is focused window . Now I need a function which can tell me Handle for this EURUSD chart.
Ali Akcaagac
168
Ali Akcaagac  
Go here grab "boost_2.mq4" and look at the function IsTopWindow at the bottom. The function does exactly what you are asking for. Testing for the active Window.
Zirkon
122
Zirkon  
kjaved8:
I know about WindowHandle() but I asked that I want to know Handle for currently focused/Active chart. WindowHandle() returns only chart handle in which EA is running. Let suppose that I clicks on EURUSD chart window that means now EURUSD chart is focused window . Now I need a function which can tell me Handle for this EURUSD chart.

There is no function to know which chart/window is active on mql4 (unless you run a custom code on each window), so you need to use WINAPI. Check the documentation.

To add comments, please log in or register