/ Forums / Advansys Formativ / Creating Solutions with Formativ / Syntax for webbrowser events / Reply To: Syntax for webbrowser events
Our engineers confirmed the behaviour, we also noticed few other events also not fire. We are not sure what cause this events not to fire, potentially a low level component integration.
Given OnProgressChange events work, you can use the following workaround to determine page loaded successfully.
Note:
– Utilities.IHTMLDocumentFromViewHandle: See Formativ Language Guide for more information. This method return an instance of the IHTMLDocument2 interface obtained from the window.
– IHTMLDocument2 : http://msdn.microsoft.com/en-us/library/aa752574(VS.85).aspx
– Debugging Applet: http://www.advansyscorp.com/forums/topic/9151084651/
dim gURLPrecossed
Sub Main(Client, GWEvent)
gURLPrecossed = false
Maindlg.embeddedWB.navigate("www.advansyscorp.com")
Maindlg.ShowModal
End Sub
Sub embeddedWBProgressChange(Sender, Progress, ProgressMax)
utilities.trace("-> embeddedWBProgressChange gURLPrecossed: " & gURLPrecossed)
utilities.doevents
' Event can fired more then once, we will skip if gURLPrecossed global variable
' is TRUE. Set gURLPrecossed to FALSE on loading page (i.e. Navigate() method).
if (not gURLPrecossed) then
' Skip if engaged in a navigation or downloading operation.
if (Maindlg.embeddedWB.Busy) then
utilities.trace("-> embeddedWBProgressChange embeddedWB.Busy")
exit sub
end if
dim oDocument
if Utilities.IHTMLDocumentFromViewHandle(Maindlg.Handle, oDocument) = 0 then
utilities.trace("-> embeddedWBProgressChange oDodument.title: " & oDocument.title)
if ((Instr(1, oDocument.title, "http 404 not found", vbTextCompare) > 0) or (Instr(1, oDocument.title, "cannot find server", vbTextCompare) > 0)) then
utilities.trace("-> embeddedWBProgressChange 'Page not found'")
else
utilities.trace("-> embeddedWBProgressChange Page loaded")
end if
gURLPrecossed = true
else
utilities.trace("-> embeddedWBProgressChange 'No handle'")
end if
set oDocument = nothing
end if
utilities.trace("<- embeddedWBProgressChange")
End Sub
Hope this helps.
Regards,
Advansys Support