title: Getting Cross-thread operation not valid in SetWindowPos()
body: <p>I am trying to access a form from a different thread to that on which the form was created, and finally ended up with an error:</p>
  
  <blockquote>
    <p>Cross thread operation not valid</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>public static void MakeTopMost(Form form)
  {
      SetWindowPos(form.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS);
  }
  </code></pre>
  
  <p>I am passing a form which is running in another thread.  I tried testing <code>InvokeRequired</code>, but it is always false.</p>
  
  <p>I am new to threading.</p>