title: Adding child window to Metatrader4's chart via DLL - blinking (not redrawing)
body: <p>I would like to add a child window to Metatrader4's chart window which always stays on top, without blinking, just statically there all the time upon eveything (in parent window). I am doing this from a DLL (C++).</p>
  
  <p>I call this method from the mql side:</p>
  
  <pre><code>MT4_EXPFUNC int __stdcall testWindow(HWND hwnd) {
      prnt_hWnd = hwnd;
      CreateThread(0, NULL, ThreadProc, (LPVOID)L"Window Title", NULL, NULL);
      return 0;
  }
  </code></pre>
  
  <p>The parent window's (chart) handle is given as a parameter.</p>
  
  <pre><code>DWORD WINAPI ThreadProc( LPVOID lpParam )
  {
      MSG messages;
      /*
      ... in createWindowClass:
  
  
          WNDCLASSEX wc;
          wc.hInstance =  GetModuleHandle(NULL);
          wc.lpszClassName = (LPCWSTR)L"MyClass";
          wc.lpszClassName = (LPCWSTR)szClassName;
          wc.lpfnWndProc = DLLWindowProc;
          wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
          ...
      */
      CreateWindowClass(L"MyClass");
      HWND hwnd = CreateWindowEx (0, L"MyClass", NULL, WS_VISIBLE | WS_CHILD , CW_USEDEFAULT, CW_USEDEFAULT, 400, 300, prnt_hWnd, NULL, GetModuleHandle(NULL), NULL );
      ShowWindow (hwnd, SW_SHOWNORMAL);
      while (GetMessage (&amp;messages, NULL, 0, 0))
      {
          TranslateMessage(&amp;messages);
          DispatchMessage(&amp;messages);
      }
      return 1;
  }
  </code></pre>
  
  <p>I handle window's messages this way:</p>
  
  <pre><code>LRESULT CALLBACK DLLWindowProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  {
      switch (message) {
          case WM_PAINT: {
               PAINTSTRUCT ps;
               BeginPaint( hwnd, &amp;ps );
               EndPaint( hwnd, &amp;ps );
               return 0;
             }
          case WM_COMMAND:
                /* */                   
                 break;
          case WM_DESTROY:
              PostQuitMessage (0);
              break;
          default:
              return DefWindowProc (hwnd, message, wParam, lParam);
      }
      return 0;
  }
  </code></pre>
  
  <p>My child window at the begining appears, then after (I guess) the parent window is getting being redrawn, suddenly it disappears, then it is just blinking (fastly appears-disappear).</p>
  
  <p>My goal is to have a child window on that chart statically, so always topmost, without blinking. I could achieve this only without the WS_CHILD property. But then my child window is not ON the parent. </p>