type xx = function(): string; stdcall;是什么意思
procedure TFrmFirewatcherDllTest.btnCmdStartTestClick(Sender: TObject);
type pStartCmd=function (pbuff:PChar;nLen:Word):integer; stdcall;
var
hDll:Cardinal;
startCmd:pStartCmd;
arrCmd:array [0..255] of Char;
nLen:Word;
i:Integer;
str:string;
begin
btnCmdStartTest.Enabled := False;
hDll := LoadLibrary('..\SourceDLL\FirewatcherDLL.dll');
try
if hDll>32 then
begin
@startCmd := GetProcAddress( hDll,'START');
if Assigned( startCmd ) then
begin
nlen := startCmd( arrCmd, 256 );
for i:= 0 to nLen-1 do
begin
str := str +' '+ IntToHex( Ord(arrcmd[i]), 2 );
end;
Memo1.Lines.Add(IntToStr( Memo1.Lines.Count+1)+ ' 【开机】指令长度:'+inttostr(nLen)+ '; 指令数据:'+quotedstr( trim( str ) ) )
end;
end;
finally
FreeLibrary( hDll );
btnCmdStartTest.Enabled := True;
end;
end;