高手请进,C程序转成Delphi可调用的形式后,调用语句该怎样写,十万火急(100分)

  • 主题发起人 _liangzi_
  • 开始时间
L

_liangzi_

Unregistered / Unconfirmed
GUEST, unregistred user!
C源程序:
struct ComPktInfo{
char JYM[7]

size_t PktLen

size_t FileLen

char FileName

char DYLSH[9];
char JYBZ[2];
long JCH

long RZLSH

}

int WINAPI fcstsjjh(struct ComPktInfo *pstInfo,
char *pSndPkt,
char *pSndFile,
char **ppRcvPkt,
char **ppRcvFile,
long lWait,
char fsbz[2]
);
我已经把上面的程序翻译成Delphi的程序如下
type
ComPktInfo = record
JYM:array [0..6] of char;
PktLen:Cardinal;
FileLen:Cardinal;
FileName:char;
DYLSH:array [0..8] of char;
JYBZ:array [0..1] of char;
JCH:longint;
RZLSH:longint;
end;
SZChar=array [0..1] of char;
PComPktInfo = ^ComPktInfo;
PPChar = ^PChar;
function fcstsjjh(pstInfo:pComPktInfo;pSndPkt: PChar;pSndFile: PChar;ppRcvPkt: PPChar;ppRcvFile: PPChar;lWait: longint;fsbz:SZChar):Integer;stdcall;external 'IOHandle.DLL' name 'fcstsjjh';

那如果想赋值
pSndPkt="select * from abc"
pSndFile=""
JYM="100010"
PktLen=pSndPkt的长度
FileLen=0
JYBZ="0"
RZLSH=0
DYLSH="00000000"
Delphi语句该怎么写啊,很急的
 
var
PsInfo: ComPktInfo;
SndPkt: string;
p1: PChar;
p2: PChar;
begin
SndPkt := 'select * from abc';
with psInfo do
begin
JYM := '100010';
PktLen := length(SndPkt);
FileLen := 0;
JYBZ := ' 0';
RZLSH := 0;
DYLSH := '000000000';
end;
fcstsjjh(@psInfo,pchar(SndPkt),nil,@p1,@p2, 0, '00');
end;
 
以后多交流啊,呵呵[:)]
 
顶部