TMedConnection.HbExecute TMedConnection

function HbExecute( funName: string; vArr: array of Variant ): Variant;

Description

Method allows you to execute xHarbour functions contained in DLL files previously loaded using LoadHarbourDll method. It can be also used to call those functions from Harbour.dll file for which no explicit wrappers are provided in TMedConnection and THbConnection classes.

funName - name of the function to be executed

vArr - array of Variant values which will be passed to funName as separate arguments

Function returns a value returned by xHarbour function as Variant.

If en error occures while function is executed, it will be raised as Delphi exception of type EHbError (see HbDelphi.pas).

See also: Integrating xHarbour code

Example:

var

hdl: Cardinal;

begin

hdl := cn.LoadHarbourDll('myxhbcode.dll');

if hdl = 0 then

begin

writeln('Cannot load myxhbcode.dll');

exit;

end;

// now let's execute: MyFun('StrPar1',1000)

writeln('Result = ', cn.HbExecute('myfun',['StrPar1',1000]) );

cn.FreeHarbourDll(hdl);

end;