![]() |
|
||||||||||||||||||||||||
|
|
Controlling Internet Explorer from your Fortran applications (Example 6.1) This is a very simple example that creates an instance of Internet Explorer and asks the browser to load f90VB's Home Page. Note that you need to have an Internet connection open before executing this program, or have Internet Explorer configured to automatically dial in to your Internet Service Provider. Otherwise you will get a Page cannot be displayed message.
program Example62
!Example shows how to use f90VBA to automate Internet Explorer
!Copyright (C) 1999-2000, Canaima Software, Inc.
!Illustrates the following topics:
! - Creating an new object
! - Getting an interface to an active object
! - Setting/Retrieving property values
! - Executing object methods
! - Requesting properties/Executing methods in
! an object hierarchy
use f90VBDefs
use f90VBVariants
use f90VBAutomation
!Variants containing main objects
type(VARIANT)::IE
!Variants used to store temporal objects and collections
type(VARIANT)::VarTmp,URL
integer(HRESULT_KIND)::iRet
integer::i
real::k
type(variant)::IsVisible
print *,'NOTE: This program works only if you already have an '
print *,' open dial-up connection or a permanent internet'
print *,' connection'
!Initialize Ole
iRet = OleInitialize()
!Get an instance of Internet Explorer
IE = CreateOleObject('InternetExplorer.Application', iRet)
!Set the visible property of the browser so it appears on the screen
call PropertyPut(IE,'Visible',VariantCreate(VT_BOOL,.true.),iRet=iRet)
!Execute the Navigate Method
URL=VAriantCreate(VT_BSTR,'www.canaimasoft.com/f90VB')
VarTmp = ExecMethod(IE,'Navigate',URL,iRet=iRet)
!Release the instance to IE, leaving the browser on
call Release(IE)
!Clean variants
call VariantClear(URL)
call VariantClear(VarTmp)
!Uninitialize Ole
call OLEUninitialize()
stop
end
|
||||||||||||||||||||||||
|
Copyright
© 1998-2000 Canaima Software
For questions regarding this site, send an e-mail to webmaster@canaimasoft.com |
|||||||||||||||||||||||||