ranxero: as the subject hopefully suggests,
I have a label in a custom EA serving as a button, that allows users to click on and place pending orders.
I'd like to further indicate this to the user by changing the mouse-cursor.
I've really made a lot of recherche but couldn' find a clue how to change the mouse cursor while
it is over a certain object, here -> label.
I know how to capture mouse-move-events, but how do I change the cursor?
Thank you Fernando,
very valid points
You may find some related info here:
Forum on trading, automated trading systems and testing trading strategies
Converting MSDN C++ functions to MQL4 functions! WINAPI, User32.dll...
Stanislav Korotky, 2017.07.27 23:29
You should do something like this.
cursor.mqh
#import "user32.dll" int SetCursor(int hCursor); int LoadImageW(int instance, string lpszName, uint uType, int cxDesired, int cyDesired, uint fuLoad); #import #define IMAGE_CURSOR 2 #define LR_DEFAULTSIZE 0x00000040 #define LR_LOADFROMFILE 0x00000010
cursor.mq4
#property strict const string Image = "path-to-your-program\\MQL4\\Images\\busy_i.cur"; #include <cursor.mqh> void OnStart() { int h = LoadImageW(0, Image, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE); Print("h=", h); int p = SetCursor(h); Print("p=", p); while(!IsStopped()) { Sleep(1000); } SetCursor(p); }
It works in the sense that correct handles are received.
The cursor is not displayed though, because the terminal is setting it on every mouse event according to its internal rules, hense your custom cursor is instantly overriden. So, i think, your requirement is not doable. You should reconsider your task and find another approach for what you want to achieve.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hello,
as the subject hopefully suggests,
I have a label in a custom EA serving as a button, that allows users to click on and place pending orders.
I'd like to further indicate this to the user by changing the mouse-cursor.
I've really made a lot of recherche but couldn' find a clue how to change the mouse cursor while
it is over a certain object, here -> label.
I know how to capture mouse-move-events, but how do I change the cursor?
thank you in advance