Index: System.Windows.Forms/XplatUIWin32.cs =================================================================== --- System.Windows.Forms/XplatUIWin32.cs (revision 73907) +++ System.Windows.Forms/XplatUIWin32.cs (working copy) @@ -763,7 +763,7 @@ themes_enabled = false; - wnd_proc = new WndProc(NativeWindow.WndProc); + wnd_proc = new WndProc(InternalWndProc); FosterParent=Win32CreateWindow((int)WindowExStyles.WS_EX_TOOLWINDOW, "static", "Foster Parent Window", (int)WindowStyles.WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); @@ -1535,9 +1535,14 @@ SetWindowPosFlags.SWP_DRAWFRAME); } + private IntPtr InternalWndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) + { + if (HwndCreating != null && HwndCreating.ClientWindow != IntPtr.Zero) + HwndCreating.ClientWindow = hWnd; + return NativeWindow.WndProc (hWnd, msg, wParam, lParam); + } + internal override IntPtr DefWndProc(ref Message msg) { - if (HwndCreating != null && HwndCreating.ClientWindow != IntPtr.Zero) - HwndCreating.ClientWindow = msg.HWnd; msg.Result=Win32DefWindowProc(msg.HWnd, (Msg)msg.Msg, msg.WParam, msg.LParam); return msg.Result; } Index: System.Windows.Forms/ChangeLog =================================================================== --- System.Windows.Forms/ChangeLog (revision 73907) +++ System.Windows.Forms/ChangeLog (working copy) @@ -1,5 +1,11 @@ 2007-03-07 Chris Toshok + * XplatUIWin32.cs: create InternalWndProc so that we're guaranteed + to be called before NativeWindow.WndProc. Put the HwndCreating + magic there to hook up our Hwnd's to handles. + +2007-03-07 Chris Toshok + [merge -r72718:73765 from mwf-handle-branch, and include 2 changes to make the rest of the world happy]