Automation with f90VB
Perhaps one of the most useful and innovative features of f90VB is that it gives your Fortran programs access to COM Automation-capable objects. Automation (formerly known as OLE Automation) is a technology that allows software to expose their unique features to scripting tools and other programming languages (including Fortran).
f90VB’s Automation library contains a subset of the functionality in ABRO-F (ActiveX Broker for Fortran), another product being developed by Canaima Software. With the Automation library, you can easily load and control objects that expose the Automation dispatch interface (IDispatch), which is only one of the many interfaces ActiveX objects can expose.
In this chapter, you’ll find a general introduction to COM, Automation and ActiveX technologies. The chapter does not pretend to treat any of these topics in depth, but rather to give you enough background information to get you started and have at least a vague idea of what’s going on behind the scene. There are many books in the market that explain COM in detail, and we strongly recommend that you get some of these books if you plan do to serious work with f90VB’s Automation library.
If you are new to COM and OLE Automation, you may want to read the next two sections of this chapter. If you already have a good grip of how Automation works, you may want to quickly browse through section The IDispatch interface and even more terminology, and then jump directly into Using f90VB to control ActiveX objects.
As you read the chapter you will see several examples showing how to control Automation-enabled applications, including Microsoft Excel and Word. There is also an example of how to use ActiveX Data Objects (ADO), an Automation interface to handle databases, from your Fortran applications.
A crash course in COM, OLE Automation and ActiveX technologies
Using f90VB to control ActiveX objects
Obtaining an interface to a running Automation server
Obtaining information about errors and exceptions
Working with collections and object hierarchies
Using f90VB to access Visual Basic procedures from Fortran
Handling arguments by reference