title: PostMessage doesn't seem to work?
body: <p>I'm trying to learn how to use and receive raw input messages, and so I devised the following program to test my understanding so far...</p>
  
  <p>When I recieve the input message, I try to change the string which is displayed and place a new <code>WM_PAINT</code> message on the queue. But this message doesn't seem to get called. Only when I resize the window does the text appear different.</p>
  
  <p>Why is the <code>WM_PAINT</code> message not getting processed at all, until I resize the window for example?</p>
  
  <pre><code>#define _WIN32_WINNT 0x501
  #include &lt;Windows.h&gt;
  #include &lt;assert.h&gt;
  #include &lt;cstring&gt;
  #include &lt;cstdio&gt;
  
  LRESULT CALLBACK WinProcedure(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
  
  int WinMain(HINSTANCE hInst,HINSTANCE,LPSTR,int nCmdShow)
  {
      WNDCLASS wc;
      HWND hwnd;
  
      wc.hInstance = hInst;
      wc.lpfnWndProc = WinProcedure;
      wc.style = CS_HREDRAW | CS_VREDRAW;
      wc.cbClsExtra = 0;
      wc.cbWndExtra = 0;
      wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
      wc.hCursor = LoadCursor(NULL, IDC_ARROW);
      wc.hbrBackground = (HBRUSH)COLOR_WINDOWFRAME;
      wc.lpszMenuName = NULL;
      wc.lpszClassName = "Untitled";
  
      if (!RegisterClass(&amp;wc)) {
          // Error registering class
          return -1;
      }
  
      if (!(hwnd = CreateWindow(wc.lpszClassName, wc.lpszClassName, WS_OVERLAPPEDWINDOW, 
                      CW_USEDEFAULT,CW_USEDEFAULT,500,300,NULL,NULL,hInst,NULL))) {
          // Error creating window
          return -1;
      }
  
      ShowWindow(hwnd,nCmdShow); 
      UpdateWindow(hwnd);
  
      RAWINPUTDEVICE Rid[1];
  
      Rid[0].usUsagePage = 0x01; 
      Rid[0].usUsage = 0x06; 
      Rid[0].dwFlags = 0;   // adds HID keyboard and also ignores legacy keyboard messages
      Rid[0].hwndTarget = 0;
  
      if (RegisterRawInputDevices(Rid, 1, sizeof(Rid[0])) == FALSE) {
          return -5;
      }
  
      MSG msg;
      while (GetMessage(&amp;msg,NULL,0,0) &gt; 0) 
      { 
          TranslateMessage(&amp;msg); 
          DispatchMessage(&amp;msg); 
      }
      return 0;
  }
  
  LRESULT CALLBACK WinProcedure(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
  {
      static char buffer[5000] = "hi";
  
      if (msg == WM_PAINT) {
          PAINTSTRUCT ps; 
          HDC dc; 
          RECT r; 
          GetClientRect(hwnd,&amp;r); 
          dc=BeginPaint(hwnd,&amp;ps); 
          DrawText(dc,buffer,-1,&amp;r,DT_SINGLELINE|DT_CENTER|DT_VCENTER); 
          EndPaint(hwnd,&amp;ps);
          return 0;
      }
  
      if (msg == WM_INPUT) {
          strcpy(buffer, "Recieved input.");
          //assert(false);
          PostMessage(hwnd, WM_PAINT, wparam, lparam);
          return 0;
      }
  
      if (msg == WM_DESTROY) {
          PostQuitMessage(0);
          return 0;
      }
  
      return DefWindowProc(hwnd, msg, wparam, lparam);
  }
  </code></pre>