title: How to log/monitor selected WM_USER+n Windows messages?
body: <p>Some dialogs and data modules in my code need to delay execution and do this by calling PostMessage(). This is <em>not</em> across modules, i.e. the datamodule will have the handler for the PostMessage issued there, so will a dialog.</p>
  
  <p>There is (of course?) interaction between code in the different modules.</p>
  
  <p>I want to trace in what order some specific messages are processed when my program runs.</p>
  
  <p>(How) can I do this in Delphi XE2?</p>
  
  <p>Everything runs in the main UI thread.</p>
  
  <hr>
  
  <p>Additional notes:</p>
  
  <ul>
  <li>Simply setting breakpoints does not work (I think). Some of these messages can be fired more than once (think 'updating tree list nodes towards the root') and I'm afraid to interfere when I stop on break points.</li>
  <li>Example sequence: user starts code execution that ends with a PostMessage(X) in dialog, underlying Delphi events call third party software in datamodule that has to finish executing first, I do PostMessage(Y) to 'wait' until that is done. I suspect Ys being handled after X.</li>
  </ul>