mql4 to mql5 help

faustf

Trader
Feb 24, 2021
3
0
17
37
Hi guys i try to convert this function in mql5 someone can help me ? I don't know which way to go again
MQL4:
string MouseState()
{
    string res;
    res += "\nML: " + (((state & MOUSE_BUTTON_LEFT) == MOUSE_BUTTON_LEFT) ? "DN" : "UP");   // mouse left
    res += "\nMR: " + (((state & MOUSE_BUTTON_RIGHT) == MOUSE_BUTTON_RIGHT) ? "DN" : "UP");   // mouse right
    res += "\nMM: " + (((state & MOUSE_BUTTON_MIDDLE) == MOUSE_BUTTON_MIDDLE) ? "DN" : "UP");   // mouse middle
    res += "\nMX: " + (((state & MOUSE_X_BUTTON1) == MOUSE_X_BUTTON1) ? "DN" : "UP");   // mouse first X key
    res += "\nMY: " + (((state & MOUSE_X_BUTTON2) == MOUSE_X_BUTTON2) ? "DN" : "UP");   // mouse second X key
    res += "\nSHIFT: " + (((state & KEY_SHIFT) == KEY_SHIFT) ? "DN" : "UP");   // shift key
    res += "\nCTRL: " + (((state & KEY_CTRL) == KEY_CTRL) ? "DN" : "UP");   // control key
    return res;
}
 

Enivid

Administrator
Staff member
Nov 30, 2008
19,345
1,542
144
Odesa
www.earnforex.com
This is just a code snippet. Those MOUSE_ and KEY_ constants are a part neither of the MQL4 syntax nor of the MQL5 syntax. They should be defined somewhere in the original code. If those definitions are carried over to the MQL5 code, no conversion is required for the MouseState() function.