请高人指点,DELPHI代码转为VB代码后,所有获取方法均无法获取正常数据。
interface
const
_KEYA = $00;
_KEYB = $04;
type
TMydata = array [1..15,0..3] of string;
TParaBuf = record
ComNo: integer;
Baud: integer;
Sys_Sec: array[1..3] of integer;
User_Sec: array[1..5] of integer;
AuthorNo: array[1..6] of PChar;
UserSec: array[1..6] of integer;
end;
TPParaBuf = ^TParaBuf;
{----------------------------------}
TCardInfo = record
PublishedDate: string[33];
ExpiredDate: string[33];
CardNo: string[33];
CardClass: string[33];
end;
TPCardInfo = ^TCardInfo;
{-----------------------------------}
TICCardBuf = record
_Key: Integer;
Key : array[1..15] of PAnsiChar ;
Sector: array [1..15] of Integer;
block : array [1..15,0..3] of Integer ;
SectorInfo : array[1..15,0..3] of PAnsiChar ;
blockStr:PAnsiChar;
end;
TPICCardBuf = ^TICCardBuf;
function ReadICCardInfo(buf: TPParaBuf;var Card:TPICCardBuf):integer; export;stdcall;external 'pcsCardDll.dll';
function WriteICCardInfo(buf: TPParaBuf;Card:TPICCardBuf):integer; export;stdcall;external 'pcsCardDll.dll';
function ReadAuthorCard(buf: TPParaBuf):integer ;export; stdcall;external 'pcsCardDll.dll';
function SaveCardKey(p1: PAnsiChar):integer ;export; stdcall;external 'pcsCardDll.dll';
function Authorize(buf: TPParaBuf;wType: integer = 0): integer; export; stdcall;external 'pcsCardDll.dll';
function UnAuthorize(buf: TPParaBuf): integer; export; stdcall;external 'pcsCardDll.dll';
function GetCardInfo(buf: TPParaBuf;var p1: TCardInfo): integer; export; stdcall;external 'pcsCardDll.dll';
function SetCardInfo(buf: TPParaBuf; p1: TCardInfo): integer; export; stdcall;external 'pcsCardDll.dll';
function GetBalance(buf: TPParaBuf;var Money: real): integer; export; stdcall;external 'pcsCardDll.dll';
function SetBalance(buf: TPParaBuf; Money: real): integer; export; stdcall;external 'pcsCardDll.dll';
function GetCardNo(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function SetCardNo(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function GetCardClass(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function SetCardClass(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function GetPublishedDate(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function SetPublishedDate(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function GetExpiredDate(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function SetExpiredDate(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function ClearCardInfo(buf: TPParaBuf): integer; export; stdcall;external 'pcsCardDll.dll';
function GetErrMsg(buf: TPParaBuf;ErrNo: integer; p1: PAnsiChar): Boolean; export; stdcall;external 'pcsCardDll.dll';
function getNo(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function CSBeep(buf: TPParaBuf): integer; export; stdcall;external 'pcsCardDll.dll';
function GetSec(buf: TPParaBuf; p1, p2, p3: PAnsiChar; Sec: integer; wType: integer = 0): integer; export; stdcall;external 'pcsCardDll.dll';
function SetSec(buf: TPParaBuf; p1, p2, p3: PAnsiChar; Sec: integer; wType: integer = 0): integer; export; stdcall;external 'pcsCardDll.dll';
implementation
end.
转为VB后的代码
Option Explicit
Global Const KEYA = &H0
Global Const KEYB = &H4
Public Type TCardData
tCardStr(1 To 15, 0 To 3) As String
End Type
Public Type TParaBuf
ComNo As Integer
Baud As Integer
Sys_Sec(1 To 3) As Integer
User_Sec(1 To 5) As Integer
AuthorNo(1 To 6) As Byte
UserSec(1 To 6) As Integer
End Type
Public Type TCardInfo
PublishedDate As String * 32
ExpiredDate As String * 32
CardNo As String * 32
CardClass As String * 32
End Type
Public Type TICCardBuf
OriKey As Integer
Key(1 To 15) As Byte
Sector(1 To 15) As Integer
block(1 To 15, 0 To 3) As Integer
SectorInfo(1 To 15, 0 To 3) As Byte
blockStr As Byte
End Type
'**************************************************************************
' Prototypes
'**************************************************************************
Public Declare Function ReadICCardInfo Lib "pcsCardDll.dll" (buf As TParaBuf, Card As TICCardBuf) As Integer
Public Declare Function WriteICCardInfo Lib "pcsCardDll.dll" (buf As TParaBuf, Card As TICCardBuf) As Integer
Public Declare Function ReadAuthorCard Lib "pcsCardDll.dll" (buf As TParaBuf) As Integer
Public Declare Function SaveCardKey Lib "pcsCardDll.dll" (p1() As Byte) As Integer
Public Declare Function Authorize Lib "pcsCardDll.dll" (buf As TParaBuf, Optional wType As Integer = 0) As Integer
Public Declare Function UnAuthorize Lib "pcsCardDll.dll" (buf As TParaBuf) As Integer
Public Declare Function GetCardInfo Lib "pcsCardDll.dll" (buf As TParaBuf, ByRef p1 As TCardInfo) As Integer
Public Declare Function SetCardInfo Lib "pcsCardDll.dll" (buf As TParaBuf, p1 As TCardInfo) As Integer
Public Declare Function GetBalance Lib "pcsCardDll.dll" (buf As TParaBuf, Money As Double) As Integer
Public Declare Function SetBalance Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal Money As Double) As Integer
Public Declare Function GetCardNo Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1 As String) As Integer
Public Declare Function SetCardNo Lib "pcsCardDll.dll" (buf As TParaBuf, p1() As Byte) As Integer
Public Declare Function GetCardClass Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1 As String) As Integer
Public Declare Function SetCardClass Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1 As String) As Integer
Public Declare Function GetPublishedDate Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1 As String) As Integer
Public Declare Function SetPublishedDate Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1 As String) As Integer
Public Declare Function GetExpiredDate Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1 As String) As Integer
Public Declare Function SetExpiredDate Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1 As String) As Integer
Public Declare Function ClearCardInfo Lib "pcsCardDll.dll" (buf As TParaBuf) As Integer
Public Declare Function GetErrMsg Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal ErrNo As Integer, ByVal p1 As String) As Boolean
Public Declare Function getNo Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1 As String) As Integer
Public Declare Function CSBeep Lib "pcsCardDll.dll" (buf As TParaBuf) As Integer
Public Declare Function GetSec Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1, p2, p3 As String, ByVal Sec As Integer, ByVal wType As Integer) As Integer
Public Declare Function SetSec Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1, p2, p3 As String, ByVal Sec As Integer, ByVal wType As Integer) As Integer
interface
const
_KEYA = $00;
_KEYB = $04;
type
TMydata = array [1..15,0..3] of string;
TParaBuf = record
ComNo: integer;
Baud: integer;
Sys_Sec: array[1..3] of integer;
User_Sec: array[1..5] of integer;
AuthorNo: array[1..6] of PChar;
UserSec: array[1..6] of integer;
end;
TPParaBuf = ^TParaBuf;
{----------------------------------}
TCardInfo = record
PublishedDate: string[33];
ExpiredDate: string[33];
CardNo: string[33];
CardClass: string[33];
end;
TPCardInfo = ^TCardInfo;
{-----------------------------------}
TICCardBuf = record
_Key: Integer;
Key : array[1..15] of PAnsiChar ;
Sector: array [1..15] of Integer;
block : array [1..15,0..3] of Integer ;
SectorInfo : array[1..15,0..3] of PAnsiChar ;
blockStr:PAnsiChar;
end;
TPICCardBuf = ^TICCardBuf;
function ReadICCardInfo(buf: TPParaBuf;var Card:TPICCardBuf):integer; export;stdcall;external 'pcsCardDll.dll';
function WriteICCardInfo(buf: TPParaBuf;Card:TPICCardBuf):integer; export;stdcall;external 'pcsCardDll.dll';
function ReadAuthorCard(buf: TPParaBuf):integer ;export; stdcall;external 'pcsCardDll.dll';
function SaveCardKey(p1: PAnsiChar):integer ;export; stdcall;external 'pcsCardDll.dll';
function Authorize(buf: TPParaBuf;wType: integer = 0): integer; export; stdcall;external 'pcsCardDll.dll';
function UnAuthorize(buf: TPParaBuf): integer; export; stdcall;external 'pcsCardDll.dll';
function GetCardInfo(buf: TPParaBuf;var p1: TCardInfo): integer; export; stdcall;external 'pcsCardDll.dll';
function SetCardInfo(buf: TPParaBuf; p1: TCardInfo): integer; export; stdcall;external 'pcsCardDll.dll';
function GetBalance(buf: TPParaBuf;var Money: real): integer; export; stdcall;external 'pcsCardDll.dll';
function SetBalance(buf: TPParaBuf; Money: real): integer; export; stdcall;external 'pcsCardDll.dll';
function GetCardNo(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function SetCardNo(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function GetCardClass(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function SetCardClass(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function GetPublishedDate(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function SetPublishedDate(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function GetExpiredDate(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function SetExpiredDate(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function ClearCardInfo(buf: TPParaBuf): integer; export; stdcall;external 'pcsCardDll.dll';
function GetErrMsg(buf: TPParaBuf;ErrNo: integer; p1: PAnsiChar): Boolean; export; stdcall;external 'pcsCardDll.dll';
function getNo(buf: TPParaBuf; p1: PAnsiChar): integer; export; stdcall;external 'pcsCardDll.dll';
function CSBeep(buf: TPParaBuf): integer; export; stdcall;external 'pcsCardDll.dll';
function GetSec(buf: TPParaBuf; p1, p2, p3: PAnsiChar; Sec: integer; wType: integer = 0): integer; export; stdcall;external 'pcsCardDll.dll';
function SetSec(buf: TPParaBuf; p1, p2, p3: PAnsiChar; Sec: integer; wType: integer = 0): integer; export; stdcall;external 'pcsCardDll.dll';
implementation
end.
转为VB后的代码
Option Explicit
Global Const KEYA = &H0
Global Const KEYB = &H4
Public Type TCardData
tCardStr(1 To 15, 0 To 3) As String
End Type
Public Type TParaBuf
ComNo As Integer
Baud As Integer
Sys_Sec(1 To 3) As Integer
User_Sec(1 To 5) As Integer
AuthorNo(1 To 6) As Byte
UserSec(1 To 6) As Integer
End Type
Public Type TCardInfo
PublishedDate As String * 32
ExpiredDate As String * 32
CardNo As String * 32
CardClass As String * 32
End Type
Public Type TICCardBuf
OriKey As Integer
Key(1 To 15) As Byte
Sector(1 To 15) As Integer
block(1 To 15, 0 To 3) As Integer
SectorInfo(1 To 15, 0 To 3) As Byte
blockStr As Byte
End Type
'**************************************************************************
' Prototypes
'**************************************************************************
Public Declare Function ReadICCardInfo Lib "pcsCardDll.dll" (buf As TParaBuf, Card As TICCardBuf) As Integer
Public Declare Function WriteICCardInfo Lib "pcsCardDll.dll" (buf As TParaBuf, Card As TICCardBuf) As Integer
Public Declare Function ReadAuthorCard Lib "pcsCardDll.dll" (buf As TParaBuf) As Integer
Public Declare Function SaveCardKey Lib "pcsCardDll.dll" (p1() As Byte) As Integer
Public Declare Function Authorize Lib "pcsCardDll.dll" (buf As TParaBuf, Optional wType As Integer = 0) As Integer
Public Declare Function UnAuthorize Lib "pcsCardDll.dll" (buf As TParaBuf) As Integer
Public Declare Function GetCardInfo Lib "pcsCardDll.dll" (buf As TParaBuf, ByRef p1 As TCardInfo) As Integer
Public Declare Function SetCardInfo Lib "pcsCardDll.dll" (buf As TParaBuf, p1 As TCardInfo) As Integer
Public Declare Function GetBalance Lib "pcsCardDll.dll" (buf As TParaBuf, Money As Double) As Integer
Public Declare Function SetBalance Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal Money As Double) As Integer
Public Declare Function GetCardNo Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1 As String) As Integer
Public Declare Function SetCardNo Lib "pcsCardDll.dll" (buf As TParaBuf, p1() As Byte) As Integer
Public Declare Function GetCardClass Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1 As String) As Integer
Public Declare Function SetCardClass Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1 As String) As Integer
Public Declare Function GetPublishedDate Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1 As String) As Integer
Public Declare Function SetPublishedDate Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1 As String) As Integer
Public Declare Function GetExpiredDate Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1 As String) As Integer
Public Declare Function SetExpiredDate Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1 As String) As Integer
Public Declare Function ClearCardInfo Lib "pcsCardDll.dll" (buf As TParaBuf) As Integer
Public Declare Function GetErrMsg Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal ErrNo As Integer, ByVal p1 As String) As Boolean
Public Declare Function getNo Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1 As String) As Integer
Public Declare Function CSBeep Lib "pcsCardDll.dll" (buf As TParaBuf) As Integer
Public Declare Function GetSec Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1, p2, p3 As String, ByVal Sec As Integer, ByVal wType As Integer) As Integer
Public Declare Function SetSec Lib "pcsCardDll.dll" (buf As TParaBuf, ByVal p1, p2, p3 As String, ByVal Sec As Integer, ByVal wType As Integer) As Integer
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货