ContentsIndexPreviousNext

General Rules

1. 'resource-handle' must be the handle of an open resource file. It is obtained by calling the C$RESOURCE library routine.

2. 'resource-name' must be the name of a resource item in the resource file whose handle is specified in 'resource-handle'.

3. INITIAL-STATE is only set once per control instance. After a program creates an ActiveX control only the first DISPLAY or MODIFY that specifies INITIAL-STATE will set it.

4. INITIAL-STATE failure raises one of the following exceptions:

ACU-E-INITIALSTATE Error reading resource item from resource file

ACU-E-INVALIDHANDLE Invalid control handle

ACU-E-UNEXPECTED Unexpected error

Example

... 77 RES-HANDLE USAGE HANDLE OF RESOURCE
... CALL "C$RESOURCE" USING CRESOURCE-LOAD, "PROGRAM1.RES"
GIVING RES-HANDLE.

To set the ActiveX control's initial state:

DISPLAY Calendar LINE 4 COLUMN 6 LINES 10 SIZE 40
 INITIAL-STATE (RES-HANDLE, "CALENDAR-1-INITIAL-STATE")
 HANDLE IN CALENDAR-1.

or in the screen section:

03 CALENDAR-1 Calendar LINE 4 COLUMN 6 LINES 10 SIZE 40
INITIAL-STATE (RES-HANDLE, "CALENDAR-1-INITIAL-STATE").

"CALENDAR-1-INITIAL-STATE" is the name of a resource in "PROGRAM1.RES". Its binary value is the initial state of the CALENDAR-1 ActiveX control. Note that each program that contains ActiveX controls generally has its own resource file.