Class TOleCtlr (unit Olectlr)

Inherits from

TComponent

Constructors



Functions

procedure CreateOleObject(const lpszProgID: LPCSTR);

Copies a Pascal string to a new BStr and returns the new BStr

destructor Destroy;

releases the Object instance and uninitializes OLE

save IDispatch


procedure FreeOleObject;

does some housekeeping and then calls the objects IDispatch.

procedure Invoke( var szMemberName: PChar; wFlags: Word; pvarArgs: PVARIANT; cArgs: Word; pvarResult: PVARIANT);

Initializes OLE, requests Object class to create an instance of itself, gets Object's IDispatch class and saves in FIDispatch.

procedure AssignArgument( const vSource; ptArgType: TPasType; var varArg: VARIANT);


procedure AssignResult( var varSource: VARIANT; ptResultType: TPasType; var vResult);

Initializes varArg and fills with argument(vSource) and argument type(ptArgType).

function PasToBStr( const S: String): BStr;

Converts varSource to ptResultType and assigns resulting value to vResult

make the call


Properties

Events

Variables

FIDispatch : IDispatch;


FOleInitialized : Boolean;



Constructors


Functions


procedure CreateOleObject(const lpszProgID: LPCSTR);

Copies a Pascal string to a new BStr and returns the new BStr


destructor Destroy;

releases the Object instance and uninitializes OLE

save IDispatch


procedure FreeOleObject;

does some housekeeping and then calls the objects IDispatch.Invoke method PARAMS: szMemberName - name of method or property to be invoked. wFlags - DISPATCH_METHOD, DISPATCH_PROPERTYGET, or DISPATCH_PROPERTYPUT. pvarArgs - pointer to VARIANT which contains the argument to be passed. If more than one argument, pvarArgs should be the first element of an array of VARIANTs. If no arguments, pvarArgs should be nil. cArgs - number of arguments pvarResult - pointer to VARIANT to receive result value. Should be nil if no return value


procedure Invoke( var szMemberName: PChar; wFlags: Word; pvarArgs: PVARIANT; cArgs: Word; pvarResult: PVARIANT);

Initializes OLE, requests Object class to create an instance of itself, gets Object's IDispatch class and saves in FIDispatch. This procedure must be called before the Invoke procedure


procedure AssignArgument( const vSource; ptArgType: TPasType; var varArg: VARIANT);


procedure AssignResult( var varSource: VARIANT; ptResultType: TPasType; var vResult);

Initializes varArg and fills with argument(vSource) and argument type(ptArgType). Strings are converted to BStr's

varArg.bstrVal := PasToBStr( sPropName );


function PasToBStr( const S: String): BStr;

Converts varSource to ptResultType and assigns resulting value to vResult

make the call


Properties


Events


Variables


FIDispatch : IDispatch;


FOleInitialized : Boolean;