IntPtr ipwnd=new Windowinterophelper (this). Handle;
Windowinterophelper class
Assists in interoperability between Windows presentation Foundation (WPF) and Win32 code.
Members of this class allow the caller to have internal access to the parent HWND of the WIN32 hwnd and the WPF Window. Property security checks are performed through these members.
Use this class when you need a more specific object based on its HWND.
The example scenario assumes that you need to host the WPF dialog box in the Win32 application. Initializes the windowinterophelper using the WPF Window object for the dialog box. You can then get the handle (HWND) of the WPF window from the Handle property, and use the Owner property to specify the owner of the WPF window. The following code example demonstrates how to use Windowinterophelper when hosting a WPF dialog box in an WIN32 application.
Windowinterophelper wih = new Windowinterophelper (mydialog);
wih. Owner = Ownerhwnd;
Mydialog.showdialog ();
Another scenario supported by this class is to get the HwndSource object from the WPF Window object.
HwndSource supports processing WIN32 messages directly through the Addhook method.
By using HwndSource and Addhook instead of windows, you can still handle messages that are not equivalent or unhandled in WPF.
Create a windowinterophelper using the Window source, and then call Handle on Windowinterophelper to get it from the HwndSource HWND.