Microsoft KB Archive/246609

= HOWTO: Start Internet Explorer and Navigate to a URL Using OLE Automation =

Article ID: 246609

Article Last Modified on 7/13/2004

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q246609



SUMMARY
This article shows how to start an instance of Internet Explorer, navigate to a particular Web page, and then close down Internet Explorer when the focus is switched back to Visual FoxPro.



MORE INFORMATION
Create a program and enter the following code: ON ERROR WAIT WINDOW "Internet Explorer has been shut down!" TIME 1 IE_handle = 0

IF NOT 'FOXTOOLS' $ SET('LIBRARY') SET LIBRARY TO SYS(2004)+"FoxTools" ENDIF

IEWind = MAINHWND GetActive=RegFn('GetActiveWindow','','I') && Determine if FoxPro is on top.

oie = CREATEOBJECT("internetexplorer.application") oie.Visible = .T. oie.Navigate("http://msdn.microsoft.com/vfoxpro/")

DO WHILE .T.   && Keep looping until the ActiveWindow = FoxWind DOEVENTS IF IEWind = CallFn(GetActive) EXIT ENDIF ENDDO

SET LIBRARY TO oie.Application.Quit ON ERROR

