CallLibrary

Top  Previous  Next

Prototype

 

res:=Calllibrary(intDLLHandle,strFunctionName,Parameter1)

 

or

 

res:=Calllibrary(intDLLHandle,strFunctionName,Parameter1,Parameter2)

 

or

 

res:=Calllibrary(intDLLHandle,strFunctionName,Parameter1,Parameter2,Parameter3)

 

Description

 

Calls an external function of DLL loaded

 

Parameters

 

intDLLHandle: DLL Handle.

 

strFunctionName: string corresponding to the function name

 

Parameter1, Parameter…: types parameter indicated in the mask

 

Returned value

 

res: 32 bit value

 

Notes

 

The parameters have to be passed as variables and not as explicit/calculated data

Example

//It initializes a string variable

Test:='TO BE CONVERTED IN LOWERCASE';

 

//It logs a input string

ApplicationLog('Before: '+Test);

 

//Load library

DLLHandle:=LoadLibrary('USER32.DLL');

if DLLHandle<>0 then

begin

 //Call DLL CharLowerA function

 CallLibrary(DLLHandle,'CharLowerA',Test);

 //Free memory

 FreeLibrary(DLLHandle);

end

else ApplicationLog('Unable to load USER32.DLL!');

 

//It logs output string

ApplicationLog('After: '+Test);