In the introduction to the javaswinterophelper class in the Windows SDK, there are some problems with the description and implementation of its owner attribute.
Original article: An Example scenario is if you need to host a WPF dialog box in a Win32 application. initialize the specified winterophelper with a WPF window object for the dialog. you can then get the WPF window's handle (hwnd) from the handle property and specify the owner for the WPF window with the owner property. the following code example shows how to use your winterophelper when hosting a WPF dialog box in a Win32 application.
The purpose is to set the owner attribute of the WPF window to a Win32 window handle hwnd through the owner attribute of javaswinterophelper. However, the implementation of this function is problematic. If you are interested, you can use the followingCodeTest:
Window mydialog = new window ();
Mydialog. windowstartuplocation = windowstartuplocation. centerowner;
Export winterophelper wih = new export winterophelper (mydialog );
Wih. Owner = ownerhwnd;
Mydialog. showdialog ();
the last window displayed in this Code is not in the center of the owner window. In fact, the windowinterophelper. Owner attribute is set to the _ ownerhandle Member of the window class. This member is not the same as the member set by window. Owner. Therefore, the description in this document does not match the actual implementation of WPF. This problem is basically a bug in WPF.