HOWTO: Start Internet Explorer and Navigate to a URL Using OLE Automation (246609)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 5.0a
  • Microsoft Visual FoxPro for Windows 6.0

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
				

REFERENCES

(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Dean Christopher, Microsoft Corporation.


Modification Type:MinorLast Reviewed:7/13/2004
Keywords:kbCodeSnippet kbhowto KB246609