Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Difficulty with browser control
Message
From
03/10/2008 10:45:55
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Difficulty with browser control
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01352564
Message ID:
01352564
Views:
62
Hi,

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.
Next
Reply
Map
View

Click here to load this message in the networking platform