Download MetaTrader 5
To add comments, please log in or register
Need mobile version of MetaTrader 5? Download it and trade!
HarriMQL5
285
HarriMQL5 2014.04.16 05:58 

Hello

This code used to keep an offline chart updated. Now it doesnt work. Please note that it is running on a pre-600 build.

So what is wrong with the code?:

//+------------------------------------------------------------------+
int UpdateChartWindow()
{
        static int hwnd = 0;

        if(hwnd == 0) {
                //trying to detect the chart window for updating
                hwnd = WindowHandle(sym, range);
        }
        if(hwnd!= 0) {
                if (IsDllsAllowed() == false) {
                        //DLL calls must be allowed
                        Print("Dll calls must be allowed");
                        return (-1);
                }
                if (PostMessageA(hwnd,WM_COMMAND,CHART_CMD_UPDATE_DATA,0) == 0) {
                        Print("PostMessage failed, chart window closed");
                        hwnd = 0;
                } else {
                        PostMessageA(hwnd, MT4InternalMsg, 2, 1);
                        Print("PostMessage succeed");
                        return (0);
                }
        }
        Print("window not found or PostMessage failed");
        return (-1);
}
qjol
3243
qjol 2014.04.16 10:29  
PostMessageW
/
To add comments, please log in or register