CWebBrowser - OnWindowClosingBrowser Method..
-
I have a dialog based application with WebBrower control on it. The URL that i open in the webbrowser uses script having Windows.close() method. When the URL is closing it calls OnWindowClosing Browser Method, and later post a message saying "The webpage you're viewing is trying to close this window. Do you want to close this window? - YES/NO" My issue is on clicking YES the dialog is not closing. What should i do to close the dialog on selecting YES in above dialog. And secondly, i want the application to return 22 on clicking YES. How to may Dialog application return 22 on clicking YES above. Thank you..
-
I have a dialog based application with WebBrower control on it. The URL that i open in the webbrowser uses script having Windows.close() method. When the URL is closing it calls OnWindowClosing Browser Method, and later post a message saying "The webpage you're viewing is trying to close this window. Do you want to close this window? - YES/NO" My issue is on clicking YES the dialog is not closing. What should i do to close the dialog on selecting YES in above dialog. And secondly, i want the application to return 22 on clicking YES. How to may Dialog application return 22 on clicking YES above. Thank you..
Member 3834630 wrote:
My issue is on clicking YES the dialog is not closing.
After the browser control is closed are you relaying that event to the dialog or attempting to close the dialog with a call to EndDialog()?
1300 calories of pure beef goodness can't be wrong!
-
Member 3834630 wrote:
My issue is on clicking YES the dialog is not closing.
After the browser control is closed are you relaying that event to the dialog or attempting to close the dialog with a call to EndDialog()?
1300 calories of pure beef goodness can't be wrong!
Hello, I have not done anything currently. What should i do to get dialog closed when Windows.Close() method is called in script. What to do to close the dialog when YES is selected and return a different value to ExitInstance(). Thank you..
-
Hello, I have not done anything currently. What should i do to get dialog closed when Windows.Close() method is called in script. What to do to close the dialog when YES is selected and return a different value to ExitInstance(). Thank you..
Member 3834630 wrote:
What should i do to get dialog closed when Windows.Close() method is called in script.
It really depends on your requirements. One way would be to create a class that implements the DWebBrowserEvents2[^] dispatch interface and register it with the appropriate connection point in the browser control. When the windowClosing() method is invoked (in your dialog) you can cancel the event, display the prompt to close the window and if the user selects yes simply call EndDialog() with the desired error code:
void CMyDialog::onWindowClosing(
VARIANT_BOOL IsChildWindow,
VARIANT_BOOL *Cancel)
{
*Cancel = VARIANT_TRUE;UINT result = MessageBox("Close window?", "Close Window?", MB\_YESNO); if(IDYES == result) { EndDialog(23); }
}
I am a lean mean ground beef machine!!!