CWebView::GetSafeHwnd Method  
 
HWND GetSafeHwnd();

The GetSafeHwnd method returns the handle to the host window.

Parameters

None.

Return Value

If the method succeeds, the return value is a window handle. If the method fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks

This method is similar to CWnd::GetSafeHwnd in that it returns NULL if the class is not attached to a browser instance. This method would typically be used to retrieve the window handle created using the Create method. Note that this is not the handle to the child window used by the WebView2 browser, it is the handle to the window hosting the browser. To get the browser child window, use the GetChildWindow method.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: cshtmv12.lib

See Also