Programming Guide:xppguide

Using COM/ActiveX constants and types Foundation

COM/ActiveX components often define certain values to be used as property values or method parameters. These values are defined in the COM/ActiveX component's type library and are similar to #define values in Xbase++. A utility program is included to generate Xbase++-include files which contain define values for the contants defined by a certain COM/ActiveX component.

Generating an include file for a COM/ActiveX component

The Xbase++ utility TLB2CH.EXE can be used to create Xbase++ header files with the contants defined by COM/ActiveX components. Once the utility has been run, each COM/ActiveX constant is represented by a #define value that can be used in application code.

Although constants in Xbase++ are to be defined in upper case only, with the usage of TLB2CH.EXE an exception is introduced to this convention. Since the constants are taken as defined by the COM/ActiveX component developer, therefore, the #define values generated by TLB2CH.EXE will appear in mixed or lower case. This is done for compatibility with code written for other development systems.

Using colors

Some ActiveX controls allow to specify colors as property values or method parameters. The color values used with ActiveX differ from the colors used in Xbase++. The function AutomationTranslateColor()must be used to convert Xbase++ color values to COM/ActiveX colors and vice versa.

The class XbpActiveXControl() automatically converts the color values used with the methods :setColorFG(), :setColorBG() and :setPresParam(). Consequently, the function AutomationTranslateColor() does not have to be used to specify the foreground or background color of an ActiveX control!

Using images

If images, such as bitmaps, are used by a COM/ActiveX component, these images are often handled in an image format different from that used in Xbase++. Instead of maintaining image data via data buffers or handles, COM/ActiveX components often use a dedicated COM component named IPicture for that purpose. The methods XbpBitmap:getIPicture() and XbpBitmap::setIPicture() are provided for manipulating IPicture COM components in an Xbase++ application. Similar methods exist within the XbpIcon() class.

Using fonts

COM/ActiveX components often use a dedicated COM component named IFont for the purpose if maintaining fonts. The methods :getIFont() and :setIFont() are provided for manipulating IFont COM components in an Xbase++ application.

The class XbpActiveXControl() automatically handles fonts through the methods :setFont() and :setFontCompoundName() Consequently, using :getIFont() and :setIFont() is rarely required when working with ActiveX controls!


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.