#COM metastatement  


Declare information to be included in a COM Type Library.


#COM CLASS ClassName  [, ClassName...]

#COM DOC "This is specific information to be used in the Help String"

#COM HELP "MyProg.chm"[, &H1E00]

#COM NAME "LibName", 3.32

#COM GUID GUID$("{20000000-2000-2000-2000000000000002}")
#COM TLIB {ON|+ | OFF|-}


The #COM metastatement establishes information about the COM library or application which can be extracted by COM client programs.

#COM CLASS allows you to add the COM attribute to a class defined elsewhere.   The COM attribute can even be added to a class in an SLL which was compiled separately.  A class which is declared AS COM makes it available to external programs through the COM services of Windows.  When you define a class as COM, it is automatically considered to be COMMON as well.

#COM DOC specifies a help string which usually provides a general description of the COM server.  

#COM HELP specifies the name of the associated help file and the help context code.  The name must appear as a string literal, while the context code is an unsigned DWORD value greater than zero. The context code may be specified in decimal or radix format.  

#COM NAME specifies the name of the server and the version number. The name must consist of only letters, numbers, and underscore characters, and may contain no punctuation nor spaces.  If no name is specified, PowerBASIC substitutes the module name.  If no version is specified, PowerBASIC uses version number 0.0.

#COM GUID specifies the GUID which identifies the entire application or library (APPID or LIBID).  If no GUID is specified, PowerBASIC substitutes a random GUID for this purpose.

#COM TLIB ON specifies that the compiler should create a type library for the compiled EXE or DLL.

#COM TLIB OFF (default) specifies that the compiler should not create a type library for the compiled EXE or DLL.

Type Libraries only support the following data types: BYTE, WORD, DWORD, INTEGER, LONG, QUAD, SINGLE, DOUBLE, CURRENCY, OBJECT, STRING, and VARIANT. If any Methods or Properties use data types not supported by Type Libraries, you will receive a Error 581 - Type Library creation error, when using the #COM TLIB ON metastatement.

See also

CLASS, INTERFACE (Direct), INTERFACE (IDBind), Just what is COM?