What do the pros have to say: How to get mouse scroll values in MQL? [repost from the fifth forum].
First of all, it would be a good idea to decide in what form the information about the event occurrence should be received: directly or indirectly?
Assuming that writing your own DLL is not an option, why not do away with the API as well? If the indirect method is suitable:
We should loop a script that checks the index of the first visible bar in a window - WindowFirstVisibleBar (you can do it together with the number of bars in the window - WindowBarsPerChart). If they differ from the previous value, the chart has been checked. True, in this case not only the mouse wheel could be the cause (zooming in time - "+", "-", clicking Home or End, direct jump to the desired date).
In any case, there's not enough information yet to know what exactly is required from detecting a mouse wheel spin event. Then you can suggest methods.
P.S. And if you need access to window handling function, it is SetWindowLongPtr (see msdn). But you can't do without DLL here, because you can't assign a new message processing procedure located in MQL code.
The thought of controlling the scrolling chart, was. But not comilfo....
No, you need to define a scrolling wheel event.
In any case, there is not enough information yet to know exactly what is required from the mouse wheel spin event detection. Then methods can be suggested.
what exactly is required?
the list of course. what else? :)
Might help.
No. It's a hook. I don't know how to get the address of the function in MQL.
I did so:
- user clicks to close MT window
- I ask: did you change indicator - save? Yes No Cancel
When you cancel no one goes anywhere.
Yes-save and exit, no-save and exit.
It's primitive.
Hooks have nothing to do with it, really.
> We are talking about Windows DLLs. Writing your own is not yet considered.
Good luck...
The terminal window should have a custom event handling procedure with interception - that's it.
you mean SetWindowLong ?
what exactly is required?
the list spinning of course. what else? :)
If the list (CListCtrl) is its own object, what's the problem? It is the list that receives mouse events, not the Meta Trader window.
Or are we talking about a list based on MT4 chart objects?
If the list (CListCtrl) is its own object, what is the problem? It is the list that receives events from the mouse, not the Meta Trader's window.
Or are we talking about a list based on MT4 graphical objects?
If there is no problem, please specify how to determine the FACT of mouse wheel shift. When a mouse pointer is in the MT4 window. It's very interesting :)
Of course - by means of Windows.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
After surfing the net, I've decided on three possibilities:
Handling of WM_MOUSEWHEEL 1.
Processing WM_INPUT. 2.
3. Receiving mouse data from DirectInput.
The first case assumes that there is a window where this event is handled. Unfortunately I don't know how to get to the message queue of terminal window from MQL, therefore this variant fell out. http://www.rsdn.ru/article/baseserv/hookdll.xml
The second variant also implies a window but I hoped that by calling the GetRawInputBuffer function I would be able to receive data without passing the terminal.
I have been able to use all the registration and retrieval functions. Namely:
GetRawInputDeviceInfo
GetRawInputDeviceList
GetRegisteredRawInputDevices
RegisterRawInputDevices
But the GetRawInputBuffer function I was looking for didn't work. The buffer is empty and no data is captured into it.
Unfortunately, I failed too with the third option, because I don't know how to get an instance of LPDIRECTINPUTDEVICE8 / LPDIRECTINPUT8 interface.
Experts, what's your advice?