title: SetParent: Window reacts slow when getting focus
body: <p>I have a problem with the SetParent function of the Windows API. I'm using it to inject one of my windows into the Window of an external application (like Notepad). My Window contains an EditWindow as Child Window and a few buttons, nothing more. I use something like this:</p>
  
  <pre><code>long style = GetWindowLong(hwnd, GWL_STYLE);
  style |= WS_CHILD;
  style &amp;= ~WS_POPUP;
  SetWindowLong(hwnd, GWL_STYLE, style);
  SetParent(hwnd, newParent);
  </code></pre>
  
  <p>This works, however if I click from outside of the external application into the textbox, it takes several <em>seconds</em> until it gets the focus. In the meantime nothing happens, even with Spy++ I can't catch any messages within this delay.</p>
  
  <p>The strange thing is also that this only seems to happen with my specific application (its some very old and special measurement software), with notepad for example the delay does not happen.</p>
  
  <p>So, here is my question: What could potentialy cause this problem? Are there cases where SetParent could cause such a behaviour?</p>
  
  <p>Greets,
  cpp_beginner</p>