


Following is a list of C types that you might find in an ActiveX definitions copybook. The second column contains the corresponding COBOL data class. The third column is a description of the type of data.
| C Type
| COBOL Data Class
| Description of Data
|
| boolean
| numeric
| TRUE or FALSE (1 or 0)
|
| BSTR
| alphanumeric
| a character string, any data item or literal, typically USAGE DISPLAY
|
| char
| alphanumeric
| a single 8 bit signed character, any data item or literal, typically USAGE
DISPLAY
|
| CURRENCY
| numeric
| a currency value, any numeric data item or literal, usually containing a
decimal point
|
| DATE
| alphanumeric
| a date in either numeric or alphanumeric form
|
| double
| numeric
| a double (8 byte) floating point number, any numeric data item or literal,
typically USAGE DOUBLE
|
| IDispatch*
| N/A
| cannot be used in ACUCOBOL-GT 5.0.0
|
| int
| numeric
| a 32 bit signed integer, any numeric data item or literal
|
| int64
| numeric
| a 64 bit signed integer
|
| IUnknown*
| numeric
| a pointer to the Iunknown interface, a USAGE POINTER or USAGE HANDLE item
|
| long
| numeric
| a 32 bit signed integer, any numeric data item or literal
|
| SAFEARRAY
| N/A
| cannot be used in ACUCOBOL-GT 5.0.0
|
| SCODE
| numeric
| a 32 bit unsigned integer, any numeric data item or literal
|
| short
| numeric
| a 16 bit signed integer, any numeric data item or literal
|
| single
| numeric
| a single (4 byte) floating point number, any numeric data item or literal,
typically USAGE FLOAT
|
| uint64
| numeric
| a 64 bit unsigned integer, any numeric data item or literal
|
| unsigned char
| numeric
| an 8 bit unsigned integer, any numeric data item or literal
|
| unsigned int
| numeric
| a 32 bit unsigned integer, any numeric data item or literal
|
| unsigned long
| numeric
| a 32 bit unsigned integer, any numeric data item or literal
|
| unsigned short
| numeric
| a 16 bit unsigned integer, any numeric data item or literal
|
| VARIANT
| any
| any data item or literal
|
| void*
| numeric
| a generic pointer, typically USAGE POINTER
|
| wchar_t
| alphanumeric
| a "wide" character string (16 bits per character), any data item or literal, typically USAGE DISPLAY |
0.00 is 30 December 1899, 12:00 A.M.
5.25 is 4 January 1900, 6 A.M.
5.875 is 4 January 1900, 9 P.M.
If DATE is in alphanumeric form, the date can be in a variety of formats. For example, the following are all valid formats:
"25 January 1996"
"8:30:00"
"20:30:00"
"January 25, 1996 8:30:00"
"8:30:00 Jan. 25, 1996"
"1/25/1996 8:30:00"
You may pass a USAGE POINTER item that was filled in by a prior method or property call, or you may pass a USAGE HANDLE item which contains a handle to an ActiveX control or OLE object. You may not pass a screen section item name as a handle of an ActiveX control. Instead, use the Format 11 SET verb to get a handle to the ActiveX control (e.g., SET my-handle to HANDLE OF screen-section-item). The IUnknown interface is part of the Microsoft COM (Component Object Model) standard. Any COM object, OLE object, or ActiveX control exports interfaces that are used to create, use, and destroy objects. Each of these interfaces is based on a single interface called "IUnknown". This means that you may pass a pointer to any of these interfaces (objects) to a method or property that expects an "IUnknown*".
The runtime automatically converts a handle to an ActiveX control or OLE object to the "IUnknown*" type when you pass it to a method or property.
Any of these types may be followed by an asterisk to indicate that the parameter will be passed "by reference". This means that the ActiveX control or OLE object method or property may modify the contents of the passed data item.
Any type name other than those in the list is a user-defined type. User-defined types are those that are created by the ActiveX control or OLE object programmer or vendor. They always resolve to one of the types in the list but have different names to indicate their functions. For example, OLE_COLOR is a "user defined" type that is commonly used to represent colors in ActiveX controls and OLE objects. It resolves to a "unsigned long" which is a 32 bit unsigned integer. You must read the programmer's documentation of the particular ActiveX control or OLE object in order to determine how to use "user defined" types. For example, after reading about OLE_COLOR you may learn a formula to allow you to construct an OLE_COLOR if you know the red (0-255), green (0-255), and blue (0-255) components of the color you are trying to represent.
Another common "user defined" type is "IFontDisp*". This type is used to represent fonts. Some ActiveX controls and/or OLE objects have properties whose values are fonts, or methods whose parameters are fonts. You may use INQUIRE to get a "IFontDisp*" into a "HANDLE OF IfontDisp" item. "IfontDisp" is defined in "acuclass.def". Then you may modify the "Name", "Size", "Bold", "Italic", "Underline", "Strikethrough", "Weight", or "Charset" properties of the IFontDisp item using the MODIFY verb. For example:
copy "acuclass.def"
...
77 my-font-disp usage handle of IfontDisp
...
INQUIRE Calendar-1 DayFont in my-font-disp.
MODIFY my-font-disp Name = "Courier New"
@Size = 15, Bold = 1.
MODIFY Calendar-1 DayFont::Name = "Courier New"
DayFont::Size = 15, DayFont::Bold = 1.
In this case, you do not use a "HANDLE OF IfontDisp" item. Instead, the runtime creates a temporary "HANDLE OF IfontDisp" item, does the INQUIRE, and sets the properties "behind the scenes" in the processing of the MODIFY statement.
Another "user defined" type that you might see is "DataSource*". This is sometimes used as the value of a DataSource property in an ActiveX control. It resolves to the "IUnknown *" type. For example, to use the Microsoft DataGrid control and the Microsoft ADO control together, set the DataGrid control's DataSource property to the "IUnknown*" of the ADO control. As stated above, to pass an ActiveX control or OLE object as a "IUnknown*" you must pass the handle of the control or OLE object.
For example:
01 main-screen.
03 adoctrl, Adodc,
COL 14 LINE 21 LINES 2.20 CELLS
SIZE 29.00 CELLS
LICENSE-KEY "C4145310-469C-11d1-B182-00A0C922E820".
03 testgrid, Datagrid,
COL 14 LINE 9 LINES 10 CELLS
SIZE 28 CELLS
LICENSE-KEY "CDE57A55-8B86-11D0-b3C6-00A0C90AEA82".
03 PUSH-BUTTON LINE 27 COL 23 TITLE "Exit"
CANCEL-BUTTON LINES 4 CELLS SIZE 10 CELLS.
...
DISPLAY main-screen.
MODIFY adoctrl ConnectionString = "DSN=Customers".
MODIFY adoctrl DatasourceName = "Customers".
MODIFY adoctrl RecordSource = "Select * from publishers".
MODIFY testgrid Caption = "Test".
SET adoctrl-handle TO HANDLE OF adoctrl.
MODIFY testgrid DataSource = adoctrl-handle.
DISPLAY testgrid.