Y
yeszhang
Unregistered / Unconfirmed
GUEST, unregistred user!
都是调用一个Dll函数。 Delphi7的声明: funGuestCard : function(ComNumber: integer; DBSystemCode: Pchar; DBHotelCode: Pchar; Building: integer; Floor: integer; Room: integer; Door: integer; Rmm: Pchar; SD: Pchar; ST: Pchar; AlwaysOpen: integer; OpenInner: integer; CardNumber: integer; NewCard: integer; ver: integer): integer; stdcall; // ; external DllName;调用: 当前时间为:2010-03-11 20:52:11 sEndDate := PAnsiChar(FormatDateTime('yy-MM-dd', now)); sendTime := PAnsiChar(FormatDateTime('hh:nn:ss', now)); Ret := funGuestCard(StrToInt(EditCom.Text), Pchar(EditSystemCode.Text), Pchar(EditHotelCode.Text), StrToInt(EditBuilding.Text), StrToInt(EditFloor.Text), StrToInt(EditRoom.Text), StrToInt(EditDoor.Text), Pchar(psw), sEndDate, sendTime, AlwaysOpen, OpenInner, StrToInt(CardNumber.Text), ifThen(CombNewCard.ItemIndex <> -1, CombNewCard.ItemIndex), StrToInt(EditVersion.Text) );执行后,正确打开设备,完全没问题。有函数能读取出来设备时间是:2010-03-11 20:52:11正确//**********Delphi 2010的声明【把PChar改成了PAnsiChar】: funGuestCard : function(ComNumber: integer; DBSystemCode: PAnsiChar; DBHotelCode: PAnsiChar; Building: integer; Floor: integer; Room: integer; Door: integer; Rmm: PAnsiChar; SD: PAnsiChar; ST: PAnsiChar; AlwaysOpen: integer; OpenInner: integer; CardNumber: integer; NewCard: integer; ver: integer): integer; stdcall; // ; external DllName;Delphi2010的调用: 当前时间为:2010-03-11 20:52:11 sEndDate := PAnsiChar(FormatDateTime('yy-MM-dd', now)); sendTime := PAnsiChar(FormatDateTime('hh:nn:ss', now)); Ret := funGuestCard(StrToInt(EditCom.Text), PAnsiChar(EditSystemCode.Text), PAnsiChar(EditHotelCode.Text), StrToInt(EditBuilding.Text), StrToInt(EditFloor.Text), StrToInt(EditRoom.Text), StrToInt(EditDoor.Text), PAnsiChar(psw), sEndDate, sendTime, AlwaysOpen, OpenInner, StrToInt(CardNumber.Text), ifThen(CombNewCard.ItemIndex <> -1, CombNewCard.ItemIndex), StrToInt(EditVersion.Text) );也能正确执行,但是打不开设备,有函数能读取出来设备时间是:1-0-0 2:0:0,时间严重错误,好像只取了日期、时间的第一位。因为日期格式化后应为:10-03-11 时间应为:20:52:11,好像是各只取到了第一位数。。请高手指教.....很急