WindowInteropHelper.EnsureHandle Method ()
Creates the HWND of the window if the HWND has not been created yet.
Assembly: PresentationFramework (in PresentationFramework.dll)
Use the Window. This is useful when you have an automation client that can accomplish its tasks without the need for showing a window.method when you want to separate window handle (HWND) creation from the actual showing of the managed
If the native window has not yet been created, this method creates the native window, sets the Handle property, and returns the HWND. If the native window has been created already, the handle of the existing native window is returned.
If the native window is created as a result of calling this method, the SourceInitialized event is raised.
Calling the Show method does not create a new window handle. A native window is only created when no handle exists when the method is called.method more than one time does not create new window handles. Calling the method when the handle has already been created by a call to the
Window properties that are set by using native window APIs via p/invoke may not appear in the managed window APIs. For example, if you set the window to be topmost by using the native MS_EX_TOPMOST flag after the Topmost property is not guaranteed to reflect the native setting.method is called, the
Available since 4.0