title: Registering a custom win32 window class from c#
body: <p>I have a new application written in WPF that needs to support an old API that allows it to receive a message that has been posted to a hidden window.  Typically another application uses FindWindow to identify the hidden window using the name of its custom window class.</p>
  
  <p><strong>1) I assume to implement a custom window class I need to use old school win32 calls?</strong></p>
  
  <p>My old c++ application used RegisterClass and CreateWindow to make the simplest possible invisible window.</p>
  
  <p>I believe I should be able to do the same all within c#.  I don't want my project to have to compile any unmanaged code.</p>
  
  <p>I have tried inheriting from System.Windows.Interop.HwndHost and using System.Runtime.InteropServices.DllImport to pull in the above API methods.</p>
  
  <p>Doing this I can successfully host a standard win32 window e.g. "listbox" inside WPF.
  However when I call CreateWindowEx for my custom window it always returns null.</p>
  
  <p>My call to RegisterClass succeeds but I am not sure what I should be setting the
  WNDCLASS.lpfnWndProc member to.</p>
  
  <p><strong>2) Does anyone know how to do this successfully?</strong></p>