The Running Objects Table
The PL/B Automation Server supports a Running Objects Table (ROT) that allows the pre-loading and sharing of program objects. In addition, the ROT support allows the programmer to create unique class identifiers that can be associated with a specific program object. This capability allows a user to access a PL/B program object by creating an AUTOMATION object for a user defined classid or progid.
Two PLBWIN command line options named '-rotreg' and '-rotunreg' have been added. The '-rotreg' command line option registers the ROT information. The '-rotunreg' command option removes or unregisters the ROT information to be removed/unregistered.
ROT program objects can be used either in a Single Use mode or in a Multiple Use mode.
If an object is in Single Use mode, only one client can use it at a time. Once the object has been connected to a client, it will not be connected again until a SETMODE statement with the control *Threadrdy=ON is executed.
If an object is in Multiple Use mode, more than one client can use the program object at one time. If the object is a program object that returns events using the EVENTSEND statement with the *CLIENT keyword, the event is sent to all of currently attached clients.
The configuration information that controls the ROT objects is defined in a standard Windows INI file named 'plbrot.ini'. Each section name is used as a unique program identifier. If the program identifier is terminated with a period (.) followed by digits, it is assumed to be a version dependent identifier. Each section can have the following parameters:
|
Parameter Name |
Type |
Description |
|
CLSID |
Class Id |
Supplies the class identifier for the object. |
|
CMDLINE |
String |
The PL/B command line used to execute the object. |
|
COUNT |
Number |
The initial count of objects to be created. The default value is zero. |
|
USESEVENTS |
Boolean |
This parameter indicates the program object type. If the value is zero, a Plbwin.ProgramNE object is created. Otherwise, a Plbwin.Program object is created. The default value is zero. |
|
TYPE |
S or M |
This parameter specifies if the object is used in (S)ingle or (M)ultiple mode. The default value is "S". |
|
VISIBLE |
Boolean |
This parameter indicates if the PL/B object should be started in a visible mode (1) or a non-visible mode (0). The default value is zero. |
Notes:
If a parameter doesn't have a default, it is required.
If the object is Single use, the COUNT specifies the minimum number to create upon startup of the automation server. If the initial pool of program objects is exhausted by being connected to clients, the automation server creates more program objects as needed. Each additional program object that is created in this manner is terminated when it executes the 'SETMODE *THREADRDY=ON' operation.
If the object is Multiple use, the COUNT specifies the maximum number of program objects that are created at startup. These program objects are connected to a client in a rotating fashion.
Unique program object CLSID numbers can be created by using the Microsoft GUIDGEN.EXE program.
The following is a sample 'plbrot.ini' file:
The 'plbrot.ini' file must be located in the Windows directory.
Example:
Sample programs named 'ROTCLI.PLS' and 'ROTSRVS.PLS' have been generated to demonstrate how a ROT program object executing as a pre-loaded server program can be accessed by a client program.
Steps to test:
Copy 'plbrot.ini' to Windows directory.
Copy 'rotcli.plc' and 'rotsrvs.plc' to directory where PLBWIN is registered.
Register the ROT tables as follows:
plbwin -rotreg
Execute
plbwin -automation
and the two ROT server program windows should appear.
Execute
plbwin rotcli
and the client program should be able to connect to one of the ROT server programs.
After testing is completed, the ROT table entries
can be unregistered by executing the following:
plbwin -rotunreg
See Also: Automation
![]() |