ComHelper

COM and ACTIVEX Programming made easier in HotBasic

Part II – Using ComHelper

General Summary

Part I – Getting started

Part II – Using ComHelper

Part III – Using a helper file with the Use Invoke option

Part IV – Using a helper file without the Use Invoke option

Part V – Using an ActiveX helper file

Part VI – Using COM events

Starting

Run ComHelper.

It will search Windows' documentation and display a list of the library files on your computer that have objects and interfaces registered.

Finding an object or an interface

Imagine you read somewhere that the interface IPicture could help you load a .JPG picture. If you know in which library file this interface is described, then go to it.

If you don't, click the Search button, enter IPicture and ComHelper will sift through the files looking for it. If you're lucky, then there will be a matching file.

When you've located the file you need, double-click on it or press Enter.

Another window opens with details about what is inside that library file: which objects and interfaces it handles, and also what specific data types and constants are related to it.

Generating a HotBasic helper file

In order to use COM and ActiveX objects in your program, you need 2 ingredients:


(1)


Your HotBasic program (.bas)


(2)


Some COM/ActiveX definitions. Those are found in a helper file generated by ComHelper. Part of that file is generic (that is, it is always present); part is specific to the elements you select.

Once you've opened a library file, just select the elements you want included in the helper file by ticking the corresponding checkboxes in the 4 grids:

-          Interfaces: those are the interfaces to the objects you want to use,

-          Types: specific type definitions that are used by those objects,

-          Constants: specific sets of constants,

-          Event interfaces: sets of events that can be used when objects generate some events. (More on this in chapter VI).

Then click "Generate .inc". Choose a location for your file. ComHelper generates a helper file according to your selection and you're ready to use it.

Using the ComHelper helper file

For info on how to use the helper file, please refer to the following sections:

. Using a helper file with the Use Invoke option

. Using a helper file without the Use Invoke option

. Using an ActiveX helper file

. Using COM events