Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Difficulty with browser control
Message
 
 
À
03/10/2008 10:45:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01352564
Message ID:
01352565
Vues:
28
This message has been marked as a message which has helped to the initial question of the thread.
The WaitForReadyState(0 should be right after Navigate(). Only after that you can be sure that content has been downloaded.

>
>I am having difficulty with web browser control on a form. Picture shows well when I trace but only intermitently when running. I am using the code below. Any ideas?
>
>TIA,
>
>Alex
>
>
>*Method ShowMapFromHTML of a container that contains oBrowser (browser ActiveX)
>LPARAMETERS tcHTML
>LOCAL lcFileType,lcTempFile
>IF This.Visible
>	This.oBrowser.Navigate("about:blank")
>	IF '<TITLE>404 NOT FOUND</TITLE>' $ UPPER(tcHTML) OR '<TITLE>400 BAD REQUEST</TITLE>' $ UPPER(tcHTML)
>		lcFileType = 'html'
>	ELSE
>		lcFileType = 'gif'
>	ENDIF
>
>	lcTempFile = FULLPATH(CURDIR()) + 'Temp\' + SYS(2015) + "Map." + lcFileType
>	STRTOFILE(tcHTML,lcTempFile)
>	WaitForReadyState(This.oBrowser)
>
>	IF lcFileType = 'html'
>		This.oBrowser.Navigate(lcTempFile)
>	ELSE
>		This.oBrowser.Document.Body.innerHTML = [<img src=] + lcTempFile + [>]
>	ENDIF
>	This.oBrowser.Refresh()
>	*DELETE FILE lcTempFile
>ENDIF
>
>FUNCTION WaitForReadyState
>LPARAMETERS toBrowser,lnReadyState,lnMilliSeconds
>	IF EMPTY(lnReadyState)
>		lnReadyState = 4
>	ENDIF
>	IF EMPTY(lnMilliSeconds)
>		lnMilliSeconds = 4000
>	ENDIF
>
>	DECLARE INTEGER Sleep IN WIN32API INTEGER nMSecs
>
>	LOCAL lnX
>	lnX = 0
>	DO WHILE toBrowser.ReadyState # lnReadyState AND lnX < lnMilliSeconds
>		DOEVENTS
>		lnX = lnX + 1
>		Sleep(1)
>	ENDDO
>
>	IF lnX < lnMilliSeconds
>		RETURN .T. && Not timed out
>	ENDIF
>	RETURN .F.
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform