OLE browser - website stopping control (OpenInsight 32-bit Specific)
At 06 JUL 2010 04:24:58AM Jon Brewster wrote:
I have an OLE browser control that I am using to access an external website.
There is a button on the website to logout once you've finished, however once I click the button it appears to be disabling my browser control.
I can't then use the control to navigate back to the website, I can't navigate to another website. The only way I can get the control back is to close and reopen the form.
I'm hoping there is a simple solution to this, something I'm missing that can just re-initialise the ole control..
Any help would be appreciated
Jon
At 06 JUL 2010 08:59AM Bob Carten wrote:
try a button with an event like:
Send_Message(@window:'.OLE_CONTROL1', 'Navigate2', 'about:blank')
If that works, then the next step is to see if you can catch the logout when it occurs. See the help for QUALIFY_EVENT. It will tell you how to cath OLE events. I think the BeforeNavigate2 event will show you the url, you could use a Yield() statement to let that event complete, then send your navigate2 message to refresh the control. Note, you may have to experiment with this. The website may implement the logout event with javascript so that oi does not see an ole Event, or sees an event other than Navigate2.
At 06 JUL 2010 10:06AM Jon Brewster wrote:
Thanks for that,
I'm trapping the OLE events, but the first warning I get that the window is closing is a windowClosing event.
I put the following little script in to try and stop the event, but it just sails straight through and brings up the dialog.
if EventName=WindowClosing' thenreturn 1endRETURN 0
I'm wondering if I'm going about this all wrong, since if I choose to click no on the 'the webpage is trying to close the window' dialog then I can retain control of the control.
There is a flag on the windowClosing event to say that the window cannot be closed, I suppose my question now is, is there anyway to modify the event before it gets passed to the browser control to set this flag to force the window to stay open.
Thanks
Jon
At 06 JUL 2010 01:06PM Bob Carten wrote:
I think you can catch the onbeforeunload event but not stop it.
So ( I think) you would Yield() to let it complete, then try to reset the page. Check the 'Works' section of this site, you might find more useful information.
- Bob
At 08 JUL 2010 04:55AM Jon Brewster wrote:
I fixed this in the end by a bit of a work around.
I created the OLE browser control on a client window.
Then when I want to create a connection I create my client window, and position it so that it appears to be on the form.
I trap the OLE events and when I get a WindowClosing Event I destroy the client window.
It feels like a bit of a hack but it appears seamless to the user.