The PowerBASIC COM Browser Tutorial

As described in the previous topic, the PowerBASIC COM Browser is a browser utility application that exposes the Interfaces, Methods, and Properties in a type-library.  It is also used to generate an Interface structure that may be inserted into your PowerBASIC source code for use with early-binding.

Early-binding is often preferred over late binding when creating OLE Automation applications, since it offers superior performance.  Regardless of whether early-binding or late-binding is used, the PowerBASIC COM Browser shows the syntax to use.  If a type-library refers to a Help file, the PowerBASIC COM Browser can display the appropriate Interface help topic upon request.

If you are unfamiliar with COM Automation programming, you may wish to review the COM Programming chapter to gain an insight into COM programming concepts before using this tutorial.

Let's suppose we want to create an application that:

  1. Starts Microsoft Word 97

  2. Opens a new document window

  3. Enters some text

  4. Saves the file

  5. Closes the document

  6. Ends Word

Assuming we have no idea how to start writing code for this project, the best place to begin is to record a macro in Microsoft Word that performs much the same steps as we want our program to perform.  In Word, we can record a macro that performs steps 2-5.  Starting and closing Word is the only part that we cannot record (since Word must be running to run the macro!).

We can follow this same procedure with other OLE Automation programs.  We'll use Word 97 in this example simply because it is a commonly available application.

In this tutorial, we'll first use the PowerBASIC COM Browser to find the proper syntax to write our application using late binding.  After that example is done, we'll change the code to use early binding.

 

See Also

The PowerBASIC COM Browser

The PowerBASIC COM Browser user interface

Opening a type-library

Early Binding Tutorial

Late Binding Tutorial

COM Programming Introduction