title: Finding dirty region by ps.rcPaint not works when style is WS_CHILD
body: <p>I have written in C++ using WinApi procedure of painting. 
  My callback function:</p>
  
  <pre><code>/*  This function is called by the Windows function DispatchMessage()  */
  LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  {
      switch (message)                  /* handle the messages */
      {
          case WM_DESTROY:
              PostQuitMessage(0);       /* send a WM_QUIT to the message queue */
              break;
          case WM_ERASEBKGND:
              {
                  elWidget *widget = (elWidget *)GetWindowLong(hwnd, GWL_USERDATA);
                  if (widget)
                  {
                      PAINTSTRUCT ps;
                      HDC hdc = BeginPaint(hwnd, &amp;ps);
                      HBRUSH hBrush = CreateSolidBrush(widget-&gt;color.ColorRef());
                      FillRect((HDC)wParam, &amp;ps.rcPaint, hBrush);
                      DeleteObject(hBrush);
                      EndPaint(hwnd, &amp;ps);
                  }
              }
              break;
          default:                      /* for messages that we don't deal with */
              return DefWindowProc(hwnd, message, wParam, lParam);
      }
      return 0;
  }
  </code></pre>
  
  <p>It works fine for standalone windows (where style is <code>WS_OVERLAPPED</code>), but when style is <code>WS_CHILD</code> or <code>WS_CHILD | WS_VISIBLE</code> then always <code>ps.rcPaint</code> is (0,0,0,0). I don't know how fix it.</p>
  
  <pre><code>elButton::elButton(elWidget *owner)
          : elWidget(owner)
  {
      WNDCLASSEX winclChild;        /* Data structure for the windowclass */
      /* The Window structure */
      winclChild.hInstance = gThisInstance; //global variable instance
      winclChild.lpszClassName = L"Child";
      winclChild.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
      winclChild.style = CS_DBLCLKS;                 /* Catch double-clicks */
      winclChild.cbSize = sizeof (WNDCLASSEX);
  
      /* Use default icon and mouse-pointer */
      winclChild.hIcon = LoadIcon (NULL, IDI_APPLICATION);
      winclChild.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
      winclChild.hCursor = LoadCursor (NULL, IDC_ARROW);
      winclChild.lpszMenuName = NULL;                 /* No menu */
      winclChild.cbClsExtra = 0;                      /* No extra bytes after the window class */
      winclChild.cbWndExtra = 0;                      /* structure or the window instance */
      /* Use Windows's default colour as the background of the window */
      winclChild.hbrBackground = 0;// CreateSolidBrush(RGB(255, 200, 200));//(HBRUSH)COLOR_WINDOW;//COLOR_BACKGROUND;
  
      /* Register the window class, and if it fails quit the program */
      if (!RegisterClassEx(&amp;winclChild))
          return;
      hwnd = CreateWindowEx(
          0,                   /* Extended possibilites for variation */
          L"Child",         /* Classname */
          L"Title",       /* Title Text */
          WS_CHILD | WS_VISIBLE,
          100,
          100,
          40,
          40,
          owner-&gt;getHwnd(),        /* The window is a child-window to desktop */
          NULL,                /* No menu */
          gThisInstance,       /* Program Instance handler */
          this                 /* to lParam */
         );
      SetWindowLong(hwnd, GWL_USERDATA, (long)this);
  }
  </code></pre>
  
  <p>I can add link to whole project on Google Disk, but I cannot guarantee it will be permanent for years.</p>