0 out of 1 rated this helpful - Rate this topic

DWebBrowserEvents2::WindowClosing Event

Fires when the window of the object is about to be closed by script.

Syntax


void WindowClosing(
    VARIANT_BOOL IsChildWindow,
    VARIANT_BOOL *Cancel
);

Parameters

IsChildWindow
[in] A VARIANT_BOOL that specifies whether the window was created from script. Can be one of the following values.
VARIANT_FALSE
Window was not created from script.
VARIANT_TRUE
Window was created from script.
Cancel
[in, out] A pointer to a cancel flag. A VARIANT_BOOL value that specifies whether the window is prevented from closing. Can be one of the following values.
VARIANT_FALSE
Window is allowed to close.
VARIANT_TRUE
Window is prevented from closing.

Return Value

No return value.

Event DISPID


DISPID_WINDOWCLOSING

The DISPID for this event is defined in exdispid.h. Use this value to identify the event handler when implementing IDispatch::Invoke.

Remarks

This event is fired when a window is closed from script, by using the window.close method.

The default behavior of Windows Internet Explorer is to close windows that were created by script without asking the user. If an attempt is made to close the main InternetExplorer window or the WebBrowser control window through script, the user is prompted.

This event is available only to an application that is hosting the WebBrowser control installed by Microsoft Internet Explorer 5.5 and later.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Handle when window is closing
I want to handle when WebBrowser is really closing (that means user said 'OK' to close when prompted). 
What is the DISPID?

[xueqing] Implement IOleCommandTarget and IOleCommandTarget::Exec will give you the chance to close the window by handling the command of ID OLECMDID_CLOSE.
microsoft office buffer overrun
a buffer overrun has been detected which has corrupted the program internal state. The program can not safely continue execution and must be terminated and has to close.
Program Files, Microsoft, Office11\WinWord.exe.
I saw suggestions to remove the /GR compiler, and I do NOT understand what it means and how? It keeps on destroying my documents and emails in Spanish since it corrupts the mss3pes.lex and mss3pes.dll. How to get rid of it? Microsoft sent me a hotfix BUT it is for Hebrew OFIICE 2003. HELP!!!