show your code
#define WM_GETTEXTLENGTH 0xE
#define WM_GETTEXT 0xD
#import "user32.dll"
int FindWindowW(string lpClassName, string lpWindowName);
int FindWindowExW(int hWnd1, int hWnd2, string lpsz1, string lpsz2);
int SendMessageA(int hwnd, int wMsg, int wParam, int lParam);
int SendMessageA(int hwnd, int wMsg, int wParam, char &lParam[]);
void GetAndSaveAlertMsgContent()
{
int Hwnd = 0; // handle of parent window
int CHwnd = 0; // handle of textbox
Hwnd = FindWindowW("#32770", "Alert");
Print(FUNCTION, "--> Parent handle = " + (string)Hwnd);
CHwnd = FindWindowExW(Hwnd, 0, "SysListView32", NULL);
Print(FUNCTION, "--> Child handle = " + (string)CHwnd);
int textLength = SendMessageA(CHwnd, WM_GETTEXTLENGTH, 0, 0);
Print(FUNCTION, "--> Text Length = " + (string)textLength);
char ch[512]; // Ensure enough capacity for the retrieved text
ArrayInitialize(ch, 0x000);
int length = SendMessageA(CHwnd, WM_GETTEXT, textLength + 1, ch);
string contentMsg = "";
for (int j = 0; j < length; j++)
contentMsg += CharToString(ch[j]);
Print(FUNCTION, "--> Content Message = " + contentMsg);
datetime currentTime = TimeCurrent();
string currentTimeString = TimeToStr(currentTime, TIME_DATE | TIME_MINUTES);
string msgwithtime = currentTimeString + " " + contentMsg;
}
#define WM_GETTEXTLENGTH 0xE
#define WM_GETTEXT 0xD
#import "user32.dll"
int FindWindowW(string lpClassName, string lpWindowName);
int FindWindowExW(int hWnd1, int hWnd2, string lpsz1, string lpsz2);
int SendMessageA(int hwnd, int wMsg, int wParam, int lParam);
int SendMessageA(int hwnd, int wMsg, int wParam, char &lParam[]);
void GetAndSaveAlertMsgContent()
{
int Hwnd = 0; // handle of parent window
int CHwnd = 0; // handle of textbox
Hwnd = FindWindowW("#32770", "Alert");
Print(FUNCTION, "--> Parent handle = " + (string)Hwnd);
CHwnd = FindWindowExW(Hwnd, 0, "SysListView32", NULL);
Print(FUNCTION, "--> Child handle = " + (string)CHwnd);
int textLength = SendMessageA(CHwnd, WM_GETTEXTLENGTH, 0, 0);
Print(FUNCTION, "--> Text Length = " + (string)textLength);
char ch[512]; // Ensure enough capacity for the retrieved text
ArrayInitialize(ch, 0x000);
int length = SendMessageA(CHwnd, WM_GETTEXT, textLength + 1, ch);
string contentMsg = "";
for (int j = 0; j < length; j++)
contentMsg += CharToString(ch[j]);
Print(FUNCTION, "--> Content Message = " + contentMsg);
datetime currentTime = TimeCurrent();
string currentTimeString = TimeToStr(currentTime, TIME_DATE | TIME_MINUTES);
string msgwithtime = currentTimeString + " " + contentMsg;
}
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Get message of Popup Alert MT4 using:
this Script will get content message from Popup Alert dialog
Author: Nguyen Quoc Hung