title: PostThreadMessage to background thread fails
body: <p>I am trying to send a message from the main thread to background one in C# wpf. </p>
  
  <p>Background thread is the following:</p>
  
  <pre><code>        public class LoopThread()
          {
              public void Start()
              {
                  User32.MSG msg;
                  sbyte ret;
                  while(true)
                  {
                      ret = User32.GetMessage(out msg, IntPtr.Zero, 0, 0);
                      //Here the debugger never reaches
                      ......
                  }
              }
          }
  </code></pre>
  
  <p>And the Main thread:</p>
  
  <pre><code>            LoopThread loop = new LoopThread();
              Thread threadLoop = new Thread(loop.Start);
              threadLoop.Start();
  
              Thread.Sleep(100);
  
              bool postResult = User32.PostThreadMessage(
                  Convert.ToUInt32(threadLoop.ManagedThreadId),
                  WM_USER + 1,
                  UIntPtr.Zero,
                  IntPtr.Zero);
  </code></pre>
  
  <p>But <code>postResult == false</code>. And <code>GetLastWin32Error</code> returns <code>ERROR_INVALID_THREAD_ID</code>.</p>
  
  <p>So, where is the mistake?</p>