Update to offline chart not working

 

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);
}
 
PostMessageW