ContentsIndexPreviousNext

C$RESOURCE Routine

Use C$RESOURCE to load a resource file and get a resource handle or to destroy the resource handle and free any memory associated with it. The AcuBench Screen Designer saves changes made to an ActiveX control in a "state" resource file. The runtime uses the information in this resource file when displaying the ActiveX control.


Note: After an ActiveX control is displayed you may destroy the resource handle used to initialize it. The ActiveX control only references this resource handle during the first DISPLAY or MODIFY which sets the initial-state property (usually the first display). In general, you should destroy resource handles to free memory after all ActiveX controls that use them have been displayed.
Usage

CALL "C$RESOURCE"
   USING OP-CODE, parameters
   GIVING RESOURCE-HANDLE

Parameters

OP-CODE Numeric parameter

OP-CODE indicates the desired operation. The file "activex.def" contains level 78 symbolic names for these operations.

OP-CODE parameters

Vary depending on the OP-CODE chosen. These are described in the Comments section below.

RESOURCE-HANDLE PIC 9(9)

RESOURCE-HANDLE holds the return value of C$RESOURCE. Values less than or equal to zero indicate errors. This is only used by the CRESOURCE-LOAD op-code.

Comments

There are two operations available in C$RESOURCE:

1. Load a resource file and return a resource handle

2. Destroy a resource handle and free its associated memory

To use C$RESOURCE, you pass an op-code as the first parameter, followed by one additional parameter. The op-code determines which operation is performed and the meaning of the additional parameter.

Currently, there are two op-codes: CRESOURCE-LOAD and CRESOURCE-DESTROY:

CRESOURCE-LOAD This operation loads a resource file from disk and returns a resource handle. This op-code takes one additional parameter.

CRESOURCE-DESTROY This operation destroys a resource handle and releases its memory. This op-code takes one additional parameter.


Note: The behavior of this library routine is affected by the setting of the FILENAME-SPACES configuration variable. See the documentation in Appendix H, Configuration File Entries, for information about the terminating character for path names.
Example

CALL "C$RESOURCE" USING CRESOURCE-LOAD, "PROGRAM1.RES"
   GIVING RES-HANDLE.
IF RES-HANDLE > 0 THEN
   DISPLAY MSCHART LINE 10 COLUMN 10 LINE 5 SIZE 40
      INITIAL-STATE = (RES-HANDLE, "MSCHART-1-INITIAL-STATE")
      HANDLE IN MSCHART-1
   CALL "C$RESOURCE" USING CRESOURCE-DESTROY, RES-HANDLE
END-IF