调用dll

Procedure aaaaaaa(CorpName: PChar; CorpAccount,
ActualCorpName: PChar; var Amount: Double; FiscalComments: PChar;
ErrorCode,ErrorMessage: PChar);
stdcall; external 'ccc.dll';

TCorpRecord = record
CorpAccount,
ActualCorpName,
FiscalComments,
ErrorCode,
ErrorMessage: PChar;
Amount: Double;
end;
procedure TFrom1.CropQuery;
var
CorpRecord: TCorpRecord;
CorpName: string;
begin
CorpName:='233';
With CorpRecord do
begin
GetMem(CorpAccount,11);
GetMem(ActualCorpName,256);
GetMem(Fiscalcomments,256);
GetMem(ErrorCode,3);
GetMem(ErrorMessage,256);
try
aaaaaaa(pchar(CorpName),CorpAccount,ActualCorpName, Amount, Fiscalcomments,
ErrorCode, ErrorMessage);
if (ErrorCode='00')or(ErrorCode='02')or(ErrorCode='03')then
showmessage('success!');
finally
FreeMem(CorpAccount);
FreeMem(ActualCorpName);
FreeMem(Fiscalcomments);
FreeMem(ErrorCode);
FreeMem(ErrorMessage);
end;
end;

end;
var
LibHandle:THandle;
implementation

function LoadLib_Talent: HMODULE;
begin
Result := LibHandle;
if LibHandle=0 then
if not FileExists('ccc.dll') then
showmessage('本操作需要动态连接库ccc.dll')
else
Result := LoadLibrary('ccc.dll');
end;

function FreeLib_Talent: BOOL;
begin
Result := false;
if LibHandle <> 0 then
begin
Result := FreeLibrary(LibHandle);
LibHandle := 0;
end;
end;
 

 
 

 

你可能感兴趣的:(dll)