此问题是 接口调用对方程序的 DLL 文件
第一部分是 对方DLL 文件 函数的原型
第二部分是我声明的函数 和过程 问题是代码一运行到 try // 1为加油,0为不加油。
sucess := GetPersonInfo(0,lb,Pchar(formatdatetime('YYYYMMDD',now)),AppCode ,DataBuffer);这里 就提示 external exception c0000008 这个错误对方DLL函数原型Syntax:
int GetPersonInfo( int Flag, int MedKind, char* SysDate, int* AppCode, char* DataBuffer )
Arguments:
Flag IN IC卡充值标志,1为充值,0为不充值
MedKind IN 类别,1为,2 为,3为
SysDate IN 系统时间(yyyymmdd);
AppCode OUT 0 - 后台执行成功,-1 - 后台执行失败
DataBuffer OUT
Return:
0 - SUCCESS
-1 - FAILUREFunction GetPersonInfo( Flag :Integer;MedKind :Integer; SysDate :Pchar; AppCode :pInteger;DataBuffer : Pchar):Integer;export;stdcall;far;external DllName name 'GetPersonInfo';
procedure TFrmPOS.GetYBPsersonInfo(var sucess: Integer;
var ret_mes: String;chr_lb : Integer; HeadInfo: TTable);
var
DataBuffer :pchar;
appcode : pInteger;
str,tmp,riq: string;
lb : integer;
begin
try
if chr_lb= 0 then lb := 1
else lb :=3;
GetMem(DataBuffer,1500);
GetMem(AppCode,sizeof(Integer)) ; ret_mes :='';
sucess := -1; try // 1为加油,0为不加油。
sucess := GetPersonInfo(0,lb,Pchar(formatdatetime('YYYYMMDD',now)),AppCode ,DataBuffer); if AppCode^=-1 then
begin
ret_mes :='后台执行失败!' ;
DM_POS.InsertLogREcord(DM_POS.CHeadInfo.FieldByName('DKTID').asstring ,
DM_POS.CHeadInfo.FieldByName('xulh').asstring ,
'获取个人信息',
strpas(DataBuffer),
'GetPersonInfo' ,
DM_POS.CHeadInfo.FieldByName('RIQI').asstring );
end
else
str := strpas(DataBuffer);
except
ret_mes :='连接或没有插入卡'; end;
finally
FreeMem(DataBuffer,1500);
FreeMem(AppCode,sizeof(Integer));
第一部分是 对方DLL 文件 函数的原型
第二部分是我声明的函数 和过程 问题是代码一运行到 try // 1为加油,0为不加油。
sucess := GetPersonInfo(0,lb,Pchar(formatdatetime('YYYYMMDD',now)),AppCode ,DataBuffer);这里 就提示 external exception c0000008 这个错误对方DLL函数原型Syntax:
int GetPersonInfo( int Flag, int MedKind, char* SysDate, int* AppCode, char* DataBuffer )
Arguments:
Flag IN IC卡充值标志,1为充值,0为不充值
MedKind IN 类别,1为,2 为,3为
SysDate IN 系统时间(yyyymmdd);
AppCode OUT 0 - 后台执行成功,-1 - 后台执行失败
DataBuffer OUT
Return:
0 - SUCCESS
-1 - FAILUREFunction GetPersonInfo( Flag :Integer;MedKind :Integer; SysDate :Pchar; AppCode :pInteger;DataBuffer : Pchar):Integer;export;stdcall;far;external DllName name 'GetPersonInfo';
procedure TFrmPOS.GetYBPsersonInfo(var sucess: Integer;
var ret_mes: String;chr_lb : Integer; HeadInfo: TTable);
var
DataBuffer :pchar;
appcode : pInteger;
str,tmp,riq: string;
lb : integer;
begin
try
if chr_lb= 0 then lb := 1
else lb :=3;
GetMem(DataBuffer,1500);
GetMem(AppCode,sizeof(Integer)) ; ret_mes :='';
sucess := -1; try // 1为加油,0为不加油。
sucess := GetPersonInfo(0,lb,Pchar(formatdatetime('YYYYMMDD',now)),AppCode ,DataBuffer); if AppCode^=-1 then
begin
ret_mes :='后台执行失败!' ;
DM_POS.InsertLogREcord(DM_POS.CHeadInfo.FieldByName('DKTID').asstring ,
DM_POS.CHeadInfo.FieldByName('xulh').asstring ,
'获取个人信息',
strpas(DataBuffer),
'GetPersonInfo' ,
DM_POS.CHeadInfo.FieldByName('RIQI').asstring );
end
else
str := strpas(DataBuffer);
except
ret_mes :='连接或没有插入卡'; end;
finally
FreeMem(DataBuffer,1500);
FreeMem(AppCode,sizeof(Integer));
解决方案 »
- delphi窑洞关门了?
- 关于ADOQuery,中group by语句执行的疑惑,谢谢专家指教
- 用Delphi如何把一个放在文本文件里面的SQL语句执行一边?
- 如何编译synedit
- 继承TGraphicControl类的控件如何清除内容恢复透明
- 我想做一个限制用户运行程序数量的东东,请问各位大虾该如何下手??
- CSDN的xml贴子怎么保存了以后察看啊????
- idHttp控件中Get到的Html中的汉字全部显示乱码,如何解决?
- 关于.PDF文件:我当了个.PDF文件,打印功能被锁,如何解?
- 请教各位大侠delphi 中的语句n3:=(n1+n2) and $ffff 在vb中如何表示
- 调用Delphi生成的DLL,退出程序后出现内存不能read!
- 一个编辑器的简单问题,如何跳回刚才光标所在的位置?
1、int
integer2、unsigned int
longword3、HANDLE
THandle4、 unsigned
cardinal (* LongWord *) 5、unsigned char *
PByte (* PByte = ^Byte *)6、unsigned int *
PLongWord (*PLongWord = ^LongWord *)B,重點檢查定義類型與參數:
你的定義
[code=Delphi(Pascal)]sucess := GetPersonInfo(0,lb,Pchar(formatdatetime('YYYYMMDD',now)),AppCode ,DataBuffer); 與
原型定義
int GetPersonInfo( int Flag, int MedKind, char* SysDate, int* AppCode, char* DataBuffer )[/code]
sucess := GetPersonInfo(0,lb,Pchar(formatdatetime('YYYYMMDD',now)),AppCode ,DataBuffer);int GetPersonInfo( int Flag, int MedKind, char* SysDate, int* AppCode, char* DataBuffer )沒看明白???哪就多看幾遍吧 為什麼ERROR出:external exception c0000008 (外部例外這個錯誤)。。
这个问题 我先结了 我把分都给你
我再发一个贴 您主要帮我看看这个问题 先谢谢啦