TOpenSession =
function (strArgs: pchar; lngSession: pointer): longint;
stdcall;
TGetErrorMsg =
function (lngSession: longint; lngResult: longint;
strLanguage, strMessage: PChar;
lngMessageLength: int64): longint;
stdcall;
TGetLicense =
function (lngSession: longint; strLanguage : pchar; lngLength : pointer) : longint;
stdcall;
procedure TForm1.Button1Click(Sender: TObject);
var
DLLHandle : THandle;
pOpenSession : TOpenSession;
pGetErrorMsg : TGetErrorMsg;
pGetLicense : TGetLicense;
lngLength, lngResultCode, lngSession, lngRetCode, i : longint;
arChar, arChar1 :
Array [1..255]
of char;
begin
DLLHandle := LoadLibrary (PAnsiChar ('
blablubb.dll'));
@pOpenSession := GetProcAddress (DLLHandle, '
open_session');
@pGetErrorMsg := GetProcAddress (DLLHandle, '
get_error_msg');
@pGetLicense := GetProcAddress (DLLHandle, '
get_license');
lngResultCode := pOpenSession (
pchar ('
service=''
blabla''
, servicehost=''
localhost''
'),
@lngSession);
fillchar (archar1, 2, 0);
arChar1[1] := '
D';
FillChar (arChar, 255, 0); lngLength := 254;
lngResultCode := pGetLicense (lngSession, @arChar, @lngLength);
FillChar (arChar, 255, 0);
lngResultCode := pGetErrorMsg (lngSession, 11, @archar1, @arChar, 255);
end;