有个dll文件名称为cesi.dll
C中有几个函数定义如下:
#ifdef ID_FPRCAP_EXPORTS
#define ID_FPRCAP_API __declspec(dllexport)
#else
#define ID_FPRCAP_API __declspec(dllimport)
#endif
1、ID_FPRCAP_API int __stdcall LIVESCAN_GetBright(int nChannel,int *pnBright);2、ID_FPRCAP_API int __stdcall LIVESCAN_GetFPRawData(int nChannel,unsigned char *pRawData);3、ID_FPRCAP_API int __stdcall LIVESCAN_GetDesc(char pszDesc[1024]);4、ID_FPRCAP_API int __stdcall LIVESCAN_SetBufferEmpty(unsigned char *pImageData, long imageLength);咋样把他们转化为delphi的函数并调用,例如1、 我的delphi为:
function LIVESCAN_GetBright(nChannel:integer;pnBright:pInteger): integer; stdcall; external 'cesi.dll' name 'LIVESCAN_GetBright';他的调用
procedure TForm1.Button9Click(Sender: TObject);
var
lddbd1,tdh:integer;
ld:PInteger;
begin
tdh:=1;
lddbd1:=LIVESCAN_GetBright(tdh,ld);//lddbd1为1时函数调用成功,否则失败
Memo2.Text:=inttostr(integer(dbd^));
end;
这样总是调用失败。
谁能不能帮我把上面4句C函数定义转为delphi 并用button控件形式调用下(返还值为1则成功,否则失败)先谢谢大家了
C中有几个函数定义如下:
#ifdef ID_FPRCAP_EXPORTS
#define ID_FPRCAP_API __declspec(dllexport)
#else
#define ID_FPRCAP_API __declspec(dllimport)
#endif
1、ID_FPRCAP_API int __stdcall LIVESCAN_GetBright(int nChannel,int *pnBright);2、ID_FPRCAP_API int __stdcall LIVESCAN_GetFPRawData(int nChannel,unsigned char *pRawData);3、ID_FPRCAP_API int __stdcall LIVESCAN_GetDesc(char pszDesc[1024]);4、ID_FPRCAP_API int __stdcall LIVESCAN_SetBufferEmpty(unsigned char *pImageData, long imageLength);咋样把他们转化为delphi的函数并调用,例如1、 我的delphi为:
function LIVESCAN_GetBright(nChannel:integer;pnBright:pInteger): integer; stdcall; external 'cesi.dll' name 'LIVESCAN_GetBright';他的调用
procedure TForm1.Button9Click(Sender: TObject);
var
lddbd1,tdh:integer;
ld:PInteger;
begin
tdh:=1;
lddbd1:=LIVESCAN_GetBright(tdh,ld);//lddbd1为1时函数调用成功,否则失败
Memo2.Text:=inttostr(integer(dbd^));
end;
这样总是调用失败。
谁能不能帮我把上面4句C函数定义转为delphi 并用button控件形式调用下(返还值为1则成功,否则失败)先谢谢大家了
function LIVESCAN_GetFPRawData(nChannel:Integer; pRawData:PByte):Integer;stdcall; external 'cesi.dll';
function LIVESCAN_GetDesc(pszDesc:PAnsiChar):Integer;stdcall; external 'cesi.dll';
function LIVESCAN_SetBufferEmpty(pImageData:PByte; imageLength:LONG):Integer;stdcall; external 'cesi.dll';procedure TForm1.Button9Click(Sender: TObject);
var
nResult:Integer;
nBright, nChannel:Integer;
begin
nChannel := 1;
nBright := 0;
nResult := LIVESCAN_GetBright(nChannel, @nBright);//如果申明为var nBright:Integer,此处不需要@取地址
Memo2.Text := 'Result=' + IntToStr(nResult) + ' -> ' + 'nBright=' + inttostr(nBright);
end;
var
szDesc:array[0..1024 - 1] of AnsiChar;
nResult:Integer;
begin
nResult := LIVESCAN_GetDesc(@szDesc[0]);
end;
{...
}