title: Get Permanent CWnd from HWnd
body: <p>We run into a problem with temporary handles.</p>
  
  <p>As I read here: <a href="https://stackoverflow.com/questions/1504507/what-is-the-lifetime-of-a-cwnd-obtained-from-cwndfromhandle">What is the lifetime of a CWnd obtained from CWnd::FromHandle?</a>
  <code>CWnd::FromHandle()</code> will create a temporary handle. Our plan was to store the handle for later use, but this won't work.</p>
  
  <p>We also tried <code>CWnd::FromHandlePermanent()</code> but this somehow returns a null pointer .</p>
  
  <p>And also <code>mpWnd-&gt;Attach(mhWnd);</code> threw an Access violation exception.</p>
  
  <p>If possible we would like to store the <code>CWnd</code> rather than the <code>HWnd</code> and call <code>FromHandle()</code> everytime the <code>CWnd</code> is required.
  Does anybody know a solution for this?</p>