You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
HCURSOR Type.
Because I'd like to change the shape of the cursor once I am dragging a Rectangle or Canvas.
It's an handle, so an int. Please read WinAPI documentation.
Does that mean that we can't use it in MQL4 ?
What does a handle mean ?
I've read the documentation but I understood pretty much nothing.
I did write an int before it and I saw no error. But the cursor didn't change !
It's an handle, so an int. Please read WinAPI documentation.
I also tried this but it gave the error :'WINAPI' - semicolon expected
#import "user32.dll"
int HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR hCursor);
#import
I did write an int before it and I saw no error. But the cursor didn't change !
Please show source code for a simple complete test case which did not work for you.
Please show source code for a simple complete test case which did not work for you.
Actually I don't have a complete test case. I am just trying to make one thing work, which is mouse cursor change.
I put this code on the Indicator's OnChartEvent(..):
SetCursor ("C:\Windows\Cursors\aero_link_im.cur");
I'm very new to using external dll. The problem here is that the declaration of the handler doesn't work.
Can you please give me an idea of what should I do or what am I doing wrong ?
You should do something like this.
cursor.mqh
cursor.mq4
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.
How about passing some types of parameters from Winapi to MQL4 ? How do we do that ?
Can you invoke MQL4 from Winapi?
Can you invoke MQL4 from Winapi?
No, you can't invoke MQL4 from winapi, but you can have output parameters and return values in DLL functions. An example of this approach are indicators with BPNN.dll (Russian [more complete], English). See how some arrays are filled in the DLL and received in MQL.
Of course, this highly depend on DLL. In case of winapi, you are limited to functions available. In short, the answer is - it depends.
Edited, because during pasting the forum ate amperands.
however you cannot pass some types of parameters from MQL4 to Winapi (e.g. string arrays, callback functions).
There's very little data which is impossible to exchange with Win32. For example, my socket code processes the complex hostent structure supplied by Winsock. It would similarly be possible to build a hostent and pass it to Winsock if necessary. String arrays are also perfectly possible. It's just not easy.
No, you indeed can't have callbacks into MQL code from Win32. No way of calling a function such as EnumWindows().
Since this forum is now a sub-area of mql5.com, I'll mention that MT5 introduces major headaches in this area because, in a 64-bit application, many Windows handles become 8 bytes long rather than 4. You need separate DLL imports for MQL5 code depending on whether it is running as 32-bit or 64-bit. And therefore you potentially need separate paths of run-time execution around each DLL call. The socket code mentioned above provides an example of this, basically having two different paths of execution in many areas for 64-bit MQL5 vs 32-bit MQL5 or MQL4.