 <p>There are better ways to solve your problem. The typical protocol I use is:</p> <ul> <li>Register a window message using <a href="http://www.google.de/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;cad=rja&amp;ved=0CCAQFjAA&amp;url=http://msdn.microsoft.com/en-us/library/windows/desktop/ms644947%28v=vs.85%29.aspx&amp;ei=AP9VUOGwEM7asgbEwoGQDw&amp;usg=AFQjCNHLyesu0zvZPqoRPseqiIB_aU4yAA&amp;sig2=D5DF_rScIHllWpasvxGK5g" rel="nofollow"><code>RegisterWindowMessage</code></a> in both applications. The message name should contain a GUID to make it unique</li> <li>In Application A, use<br> <code>PostMessage(HWND_BROADCAST, registeredMsg, idIWantToFindYou, HWNDofA)</code><br> to publish <em>your</em> window handle to all top level windows. since there's more than one use for registered messages, and you should limit the number of messages you register, use <code>idIWantTofindYou</code> to distinguish between different commands for your message. </li> <li>The receiving application(s) B now have the window handle of the sender, and can establish a connection (e.g. by<br> <code>PostMessage(HWNDofA, registeredMessage, idHereIsMyHWnd, HWNDofB)</code></li> </ul> <p>The upside of this mechanism is not running into problems with unresponsive programs. However, the "connection" isn't immediate, so you have to change your program flow. Alternatively, you can use <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms633497%28v=vs.85%29.aspx" rel="nofollow"><code>EnumWindows</code></a> and <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms644952%28v=vs.85%29.aspx" rel="nofollow"><code>SendMessageTimeout</code></a> to probe all top-level windows.</p> <hr> <p>If you need to use the window class: </p> <p>The class name assigned by MFC is only so window classes with the same attributes get reused. I am not aware of any problems with using your own window classes. </p> <p>So the following <em>should</em> work:</p> <ul> <li>Fill a <code>WNDCLASS</code> or <code>WNDCLASSEX</code> with the required attributes</li> <li>Use <code>DefWindowProc</code> as <code>WNDPROC</code> (that's what MFC does, MFC's <code>WNDPROC</code> is set when creating the window)</li> <li>Use <a href="http://msdn.microsoft.com/en-us/library/kcb1w44w%28VS.80%29.aspx" rel="nofollow"><code>AfxRegisterClass</code></a> or <code>RegisterClass</code> to register the window class. <code>AfxRegisterClass</code> checks if the class is already registered and if the class is registered from a DLL, it will unregister the class when the DLL is unloaded. Otherwise they are roughly equivalent. </li> </ul>