我在网上找个一些跟我相同情况的例子,但都没有下文vc 中代码:结构体定义:typedef struct tagINVOICEDATA {
char szFpCode1[16];
char szFpSeriaoNo1[16];
char szFpEnVersion[8];
......
} INVOICEDATA, *PINVOICEDATA;需调用函数声明(该函数为dll中的)int WINAPI FpGetNewPage(PINVOICEDATA lpFpBuffer);我在delphi 中用记录类型代替为:
type
INVOICEDATA = record
szFpCode1: array[0..16] of char;
szFpSeriaoNo1: array[0..16] of char;
szFpEnVersion: array[0..8] of char;
.........
end;
PINVOICEDATA=^INVOICEDATA ;调用dll函数声明为:
function FpGetNewPage(lpFpBuffer:PINVOICEDATA ):integer;stdcall;external 'scanreco.dll';我现在调用该delphi 函数为:
var
FpData: INVOICEDATA;
begin
self.Memo1.Lines.Add('扫描返回代码:'+inttostr(FpGetNewPage(@FpData)));
end;
程序虽然没报错,但返回结果根本不对。。
应该怎样改写呢?
由衷感谢您的帮助。如果实在没办法,要学下vc了,用vc写个ocx来让delphi 调。
char szFpCode1[16];
char szFpSeriaoNo1[16];
char szFpEnVersion[8];
......
} INVOICEDATA, *PINVOICEDATA;需调用函数声明(该函数为dll中的)int WINAPI FpGetNewPage(PINVOICEDATA lpFpBuffer);我在delphi 中用记录类型代替为:
type
INVOICEDATA = record
szFpCode1: array[0..16] of char;
szFpSeriaoNo1: array[0..16] of char;
szFpEnVersion: array[0..8] of char;
.........
end;
PINVOICEDATA=^INVOICEDATA ;调用dll函数声明为:
function FpGetNewPage(lpFpBuffer:PINVOICEDATA ):integer;stdcall;external 'scanreco.dll';我现在调用该delphi 函数为:
var
FpData: INVOICEDATA;
begin
self.Memo1.Lines.Add('扫描返回代码:'+inttostr(FpGetNewPage(@FpData)));
end;
程序虽然没报错,但返回结果根本不对。。
应该怎样改写呢?
由衷感谢您的帮助。如果实在没办法,要学下vc了,用vc写个ocx来让delphi 调。
szFpCode1: array[0..15] of char;
显式与隐式都使用过
不行的
如果是因为数组长度问题到好办了
这个也试过的。
无念
szFpCode1: array[0..15] of char;