RPC HELP TRPCBroker CreateContext Method
function CreateContext(strContext: string): boolean;
You can use the CreateContext method of the TRPCBroker component to create a context for your application. To create context, pass an option name in the strContext parameter. If the function returns True, a context was created, and your application can use all RPC entered in the option's RPC multiple. If the TRPCBroker component is not connected at the time context is created, a connection will be established. If for some reason a context could not be created, the CreateContext method will return False.
Since context is nothing more than a client/server "B"-type option in the OPTION file (#19), standard MenuMan security is applied in establishing a context. Therefore, a context option can be granted to user(s) exactly the same way as regular options are done using MenuMan. Before any RPC can run, it must have a context established for it to on the VistA M Server. Thus, all RPCs must be registered to one or more "B"-type option(s). This plays a major role in Broker security.
A context cannot be established for the following reasons:
- The user has no access to that option.
- The option is temporarily out of order.
An application can switch from one context to another as often as it needs to. Each time a context is created the previous context is overwritten.
NOTE: See the CurrentContext property for information about saving off the current context in order to temporarily create a different context and then restore the previous context.
NOTE: Whenever the Broker makes a call to the VistA M Server, if the cursor is crDefault, the cursor is automatically changed to the hourglass symbol as seen in other Microsoft-compliant software. If the application has already modified the cursor from crDefault to something else, the Broker will not change the cursor.
NOTE: For a demonstration that creates an application context, please run the BrokerExampleEXE located in the ..\BDK32\Samples\BrokerEx directory.