COM/DCOM Vuser script structure
Caution: This protocol is supported for replay only. Support for this protocol will be discontinued in future versions.
VuGen COM Vuser scripts are structured in a special way to meet the needs of COM interfaces.

Calls to interface methods have the following names and syntax conventions:
lrc_<interface name>_<method name>(instance,...);
Note that the instance is always the first parameter passed.
The vendors of the respective COM components usually supply documentation for the interface functions.

The interface header file defines the interface pointers, as well as other variables, that can be used in the script. Each interface has an Interface ID (IID) which uniquely identifies the interface.
The format of the interface definition is:
<interface type>*<interface name> = 0; //"{<IID of the interface type>}"
In the following example, the interface type is IDispatch, the name of the interface instance is IDispatch_0, and the IID of IDispatch type is the long number string:
IDispatch* IDispatch_0= 0;//"{00020400-0000--C000-000000000046}"

The COM Vuser script consist of code that creates object instances, retrieves interface pointers and calls the interface methods. Each user action may generate one or more COM calls. Each COM call is coded by VuGen as a group of statements. Each such group is contained in a separate scope enclosed in braces. Several different statements prepare for the main call by assigning values and performing type conversions. For example, the group of calls needed to create an object may look like this:
{ GUID pClsid = lrc_GUID("student..1"); IUnknown * pUnkOuter = (IUnknown*)NULL; unsigned long dwClsContext = lrc_ulong("7"); GUID riid = IID_IUnknown; lrc_CoCreateInstance(=;pClsid, pUnkOuter, dwClsContext, =;riid, (void**)=;IUnknown_0, CHECK_HRES); }

Each COM method or API call returns an error value. VuGen sets a flag to check or not to check errors during replay, depending upon whether the call succeeded during the original recording. The flag appears as the last argument of the function call and has these values:
CHECK_HRES
|
This value is inserted if the function passed during recording and errors should be checked during replay.
|
DONT_CHECK_HRES
|
This value is inserted if the function failed during recording and errors should not be checked during replay.
|