dll调用的问题
dll中提供了一个函数,说明如下:
函数名称:IC_GetCertificate
函数功能:返回IC卡中用户证书中单个项。
格式:int IC_GetCertificate([out]BYTE ItemCode[],[out]char *ItemOper)
参数说明: BYTE ItemCode [] 技术监督局企业代码
char * ItemOper 企业操作员号
现在有几个问题;
1.这个dll是用c(或者是vc)写的,现在要在delphi中调用,我是这么写的,
function IC_GetCertificate(ItemCode: byte;ItemOper: pChar): integer; stdcall;external 'AbcmmcApi.dll'; 是否正确?类型我分别用的byte类型和pChar类型
2.里面有两个参数ItemCode和ItemOper,前面标明是out,应该是传出的意思,那我实际调用的时候需要这个ItemCode(技术监督局企业代码)和ItemOper(企业操作员号)的时候,如何获得他们的值?我一开始是这么写,但是问题多多,请帮我看看!//bow 3Q
{----------------------------------------------------
函数功能:获取ic卡中的企业编码
返回值:0 成功 其它失败
----------------------------------------------------}
function IC_GetEpCode(psEpCode: pChar): integer;
var
sTmp:string;
pCode:pchar;
n:integer;
begin
pCode:=psEpCode;
Result:=IC_GetCertificate(ItemCode,ItemOper);
if Result = 0 then
begin
sTmp:=VarToStr(ItemCode);
StrCopy(pCode,pchar(sTmp));
n:=length(sTmp);
zeroMemory(pCode+n,1);
end;
end;
{----------------------------------------------------
函数功能:获取ic卡中的操作员编码
返回值:0 成功 其它失败
----------------------------------------------------}
function IC_GetOpCode(psOpCode: pChar): integer;
var
sTmp:string;
pCode:pchar;
n:integer;
begin
pCode:=psOpCode;
Result:=IC_GetCertificateInfo(ItemCode,ItemOper);
if Result = 0 then
begin
sTmp:=VarToStr(ItemOper);
StrCopy(pCode,pchar(sTmp));
n:=length(sTmp);
zeroMemory(pCode+n,1);
end;
end;