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 appl
1) You can just subclass a normal Windows Forms class... no need for all those win32 calls, you just need to parse the WndProc message manually... is all.
2) You can import the System.Windows.Forms namespace and use it alongside WPF, I believe there won't be any problems as long as you don't intertwine too much windows forms into your WPF application. You just want to instantiate your custom hidden form to receieve a message is that right?
example of WndProc subclassing:
protected override void WndProc(ref System.Windows.Forms.Message m)
{
// *always* let the base class process the message
base.WndProc(ref m);
const int WM_NCHITTEST = 0x84;
const int HTCAPTION = 2;
const int HTCLIENT = 1;
// if Windows is querying where the mouse is and the base form class said
// it's on the client area, let's cheat and say it's on the title bar instead
if ( m.Msg == WM_NCHITTEST && m.Result.ToInt32() == HTCLIENT )
m.Result = new IntPtr(HTCAPTION);
}
Since you already know RegisterClass and all those Win32 calls, I assume the WndProc message wouldn't be a problem for you...