CWebView::Close Method  
 
BOOL Close();

The Close method closes the window and releases all browser resources.

Parameters

None.

Return Value

If the method succeeds, the return value is non-zero. If the method fails, the return value is zero. To get extended error information, call WebViewGetLastError.

Remarks

This method closes a browser window which was created using the Create method. It is recommended that you always use this method to close the window rather than posting a WM_CLOSE message because it ensures resources for the window, such as its icons, are released correctly. The process of destroying the window does not occur immediately and when this function returns it is not guaranteed the browser child window and its associated processes have completely stopped. Use the WaitUntilClosed method if you wish to wait for the cleanup process to complete.

This method will cause the WEBVIEW_EVENT_WINDOW_DETACHED event to fire as part of the normal process of destroying the window. If you implement a handler for this event, you should never delay this process by attempting to show a dialog or request input from the user (for example, by displaying a message box). At the point this event is fired, the browser objects have already been disposed and there is no way to prevent the process from completing.

If this method is not explicitly called, the class destructor will close the hosting window and release the resources allocated for the browser.

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