vb例程转delphi 不带数据结构定义的没问题 带的就有问题 请教!!! ( 积分: 100 )

W

webxiou

Unregistered / Unconfirmed
GUEST, unregistred user!
dll文件提供以下函数
Public Declare Function KGetAtStatus Lib "k950c.dll&quot
(ByVal HDev As Long, ByVal DeviceID As Long, ByRef machinestatus As MCSTATUS) As Long

Type MCSTATUS '机器状态
nYear As Long
nMonth As Long
nDay As Long
nHour As Long
nMin As Long
nSecond As Long
nWeek As Long
RecNum As Long
End Type
'以上是vb的写法 没任何问题现在改写为delphi 如下的提示出错我不知道我什么地方写错了 还请大家赐教

----------------------------------------------------
function KGetAtStatus(HDev:longint;DeviceID:longint;machinestatus:TMCSTATUS):integer;stdcall;far;external 'K950c.dll' name 'KGetAtStatus';

TMCSTATUS = record //机器状态
nYear :LongInt;
nMonth :LongInt;
nDay :LongInt;
nHour :LongInt;
nMin :LongInt;
nSecond :LongInt;
nWeek :LongInt;
RecNum :LongInt;
end;
 
帮帮忙忙
 
问题已经解决 哈
function KGetAtStatus(HDev:longint;DeviceID:longint;machinestatus:MCSTATUS):integer;stdcall;far;external 'K950c.dll' name 'KGetAtStatus';
MCSTATUS=^TMCSTATUS;
TMCSTATUS = record //机器状态
nYear :LongInt;
nMonth :LongInt;
nDay :LongInt;
nHour :LongInt;
nMin :LongInt;
nSecond :LongInt;
nWeek :LongInt;
RecNum :LongInt;
end

但是调用 该函数 成功后程序报错 又是什么问题 哎 提示为 project project1.exe raised exception class eaccessviolation with message 'access violation at address 004449A8 in module 'project1.exe'.read of address 000007C3'.
 
function KGetAtStatus(HDev:longint;DeviceID:longint;var machinestatus:MCSTATUS):integer;stdcall;far;external 'K950c.dll' name 'KGetAtStatus';
 
长识问题 哈 给非了
 
接受答案了.
 
顶部