How does the LET statement work?

From the programmer's perspective, the operation of the LET statement is very straightforward - you nominate an object variable, the Interface name (or the generic DISPATCH type), and the ProgramID (registered Object name).  From there, the LET statement initializes the Object and places the reference in the object variable.

This immediately raises an interesting question - how does the programmer know the Interface name and the ProgramID?

Simple: you can either get the information directly from the COM component, for example, using the PowerBASIC COM Browser or another Object viewer such as OLEVIEW.  Alternatively, you could obtain the information from the documentation for the component from the author or distributor of the component.

For example, Microsoft provides a substantial amount of documentation on COM automation for products such as Word™, Excel™, etc.  Obtaining such documentation for the COM component is often necessary, since just being able to create an instance on an Object is not of much practical use unless you can "drive" the Object too.  Such documentation is often included with the component itself, and should also be obtainable from the manufacturer or distributor.

 

See Also

COM Programming Introduction

What is a Dispatch Interface?

INTERFACE/END INTERFACE block