Exporting an Interface Structure

The PowerBASIC COM Browser supports exporting an Interface Structure to the clipboard or directly to a disk file.  Both options are available through the File menu, plus options to Find and Select All Interfaces:

When the PowerBASIC COM Browser exports data, it generates a set of compilable PowerBASIC INTERFACE structures that define the selected Interface(s) and Interface members.  Enumerations in the list are also exported as a list of numeric and/or string equates.  In addition, the PowerBASIC COM Browser will add a header block noting the name and other relevant details from the type library.

When developing a COM controller application, it is common for all the Interfaces to be exported to a .INC file which is included into the main application with a #INCLUDE metastatement.  However, exporting to the clipboard can be useful in situations where just one or two Interface definitions are required in the program.

Including the entire Interface definition and Enumerations for a COM Object only increases the size of the source code -- it has no impact on the size of the final compiled code.

The following is a portion of the data exported by the PowerBASIC COM Browser:

' ----------------------------------------------------------

' Library Name:      Microsoft Word 8.0 Object Library

' Library File:      C:\Office\MSWORD8.OLB

' ----------------------------------------------------------

' Version Info:

' -------------

' Company Name:      Microsoft Corporation

' File Description:  Microsoft Word for Windows® 97 object library

' File Version:      8.0

' Internal Name:     mswordtlb

' Legal Copyright:   Copyright (C) Microsoft Corporation 1983-1996.

' Original Filename: MSWORD8.OLB

' Product Name:      Microsoft® Word for Windows® 97

' Product Version:   8.0

' ----------------------------------------------------------

' ProgID:            Word.Application.8

' Interface Name:    WordApplication

'

' Interface Prefix:  Word

' ----------------------------------------------------------

 

$PROGID_WordApplication8 = "Word.Application.8"

 

INTERFACE DISPATCH WordApplication

  MEMBER GET Application<&H3E8>() AS WordApplication

  MEMBER GET Creator<&H3E9>() AS LONG

  MEMBER GET Parent<&H3EA>() AS VARIANT

  MEMBER GET Name<&H0>() AS STRING

  MEMBER GET Documents<&H6>() AS WordDocuments

  ...

 

 

See Also

The PowerBASIC COM Browser

COM Programming Introduction

What is a Dispatch Interface?

Creating an Instance of an Object

Enumerating collections

Example COM controller application