title: C++ Win32: Calling WM_PAINT from another thread using SendMessage, drawing has no effect
body: <p>I am currently developing a program (C++ Win32, Visual Studio 2012) that captures audio signals from a microphone, computes a Fourier Transformation (you know, to get the frequencies in the audio) in another thread, and finally plots the results on a screen.</p>
  
  <p>Everything works fine, except for the plotting, so this is a GUI related topic.</p>
  
  <p>In WndProc, I get a message when a buffer is full and ready to be processed, and I call</p>
  
  <pre><code>boost::thread t(&amp;ComputationThread,data);
  </code></pre>
  
  <p>to start the computation thread.</p>
  
  <p>At the end of <code>ComputationThread</code> I send a message to the GUI thread to plot the data, using a predefined fixed value and the data pointer as arguments:</p>
  
  <pre><code>SendMessage(hWnd, WM_PAINT, PARAM_FFT_COMPUTED, (LPARAM)data);
  </code></pre>
  
  <p>This works fine as well, I get the message and I can also write the computed data to a file, however, drawing on the form (e.g. using <code>SetPixel</code>) has no effect, while it has an effect when <code>wParam</code> is <em>not</em> <code>PARAM_FFT_COMPUTED</code>, for example when the form is resized.</p>
  
  <p><code>InvalidateRect</code>has no effect either.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks in advance!</p>