Finding the handle to a WPF window
Just use your window with the WindowsInteropHelper class:
// ... Window myWindow = get your Window instance...IntPtr windowHandle = new WindowInteropHelper(myWindow).Handle;
Right now, you're asking for the Application's main window, of which there will always be one. You can use this same technique on any Window, however, provided it is a System.Windows.Window derived Window class.