D
dxmqjy
Unregistered / Unconfirmed
GUEST, unregistred user!
我有如下的接口文件:
About kqdll.dll
在此动态库中共包含有8个函数,以下一个介绍其调用方法及参数说明:
1、long : GetDataNum(int port,int n) port为计算机端口号,n为考勤机机号;
2、bool : GetData(char *w) : char *w 为一个空的字符串值,长度为20以上;
两函数相辅作用,GetDataNum为返回考勤机机内记录总数(返回long类型值),
GetData为遂条取得机内数据(返回bool表示是否成功取得每一笔数据);例VB:
Private Sub Command1_Click()
Dim s As String * 23, n As Long, i As Long
Text1.Text = ""
n = FastGetDataNum(1, 1) //GetDataNum(int port,int n)
If n = -1 then
MsgBox "ERROR!"
Exit Sub
End If
ProgressBar1.Max = n
i = 1
Me.MousePointer = 11
MsgBox s
do
While FastGetData(s) //GetData(char *w)
ProgressBar1.Value = i
i = i + 1
Text1.Text = Text1.Text + s + vbCrLf
Text1.SelStart = Len(Text1.Text)
Me.Refresh
Loop
Me.MousePointer = 0
MsgBox "OK!"
End Sub
3、long: FastGetDataNum(int port,int n) port为端口号,n 为考勤机机号
4、bool: FastGetData(char *d) d为一个空的字符串值,长度大于20
同样这两个函数也为下载函数,用法同上,不同的是上两个函数下载函数偏慢,
这两个下载函数速度快得多。
5、bool: CheckTime(int port,int n) port为端口号,n 为考勤机机号
6、bool: ClearData(int port,int n) port为端口号,n 为考勤机机号
这两个函数分别为设置考勤机时间和清除机器内的记录,都返加bool值,表
示是否操作成功.
7、bool: SetOpenCard(int port,int n,unsigned char *kh) port为端口号,n为考勤机机号,kh为一个5位的字符串
8、bool: DelOpenCard(int port,int n,unsigned char *kh)
这两个函数只适用于SKM2000型的考勤门禁一体机或门禁机,SetOpenCard为赋予一张卡开门的权限,kh为该张卡
的后五位ABA号码,DelOpenCard为取消开门卡的开门权限,两函数都返加bool值,表操作是否成功.
以下是各函数在VB中的声明方法:
1、private declare function GetDataNum lib "kqdll.dll"
(byval port as integer,byval n as integer) as long
2、private declare function GetData lib "kqdll.dll"
(byval s as string) as boolean
3、private declare function FastGetDataNum lib "kqdll.dll"
(byval port as integer,byval n as integer) as long
4、private declare function FastGetData lib "kqdll.dll"
(byval s as string) as boolean
5、private declare function CheckTime lib "kqdll.dll"
(byval port as integer,byval n as integer) as boolean
6、private declare function ClearData lib "kqdll.dll"
(byval port as integer,byval n as integer) as boolean
7、private declare function SetOpenCard lib "kqdll.dll"
(ByVal port As Long, ByVal jh As Long, ByVal kh As String) As Boolean
7、private declare function DelOpenCard lib "kqdll.dll"
(ByVal port As Long, ByVal jh As Long, ByVal kh As String) As Boolean
GetData与FastGetData的仅是速度上的区别,FastGetData比GetData快一倍
但FastGetData不支持早期版本考勤机。
用FastGetData或GetData取得的记录格式说明如下:
记录格式为:00000000:0000000000000
前六位为卡号,00:00为时间,再八位为时间如20010806,再二两位为机
器编号,最后一位为类型标识
类型标识:1为中途外入,2为中途外出,3为门禁读头读卡,0为正常读卡
我在DELPHI中声名:
unit OneSub;
interface
uses Dialogs,DBTables,Registry,Controls,SysUtils,Windows,Forms,Classes;
function GetDataNum(port:integer;n:integer):integer;stdcall;export;external 'KQDLL.dll';
function GetData(s:string):Boolean;stdcall;export;external 'KQDLL.dll';
function FastGetDataNum(port:integer;n:integer):integer;stdcall;export;external 'KQDLL.dll';
function FastGetData(schar):Boolean;stdcall;export;external 'KQDLL.dll';
function CheckTime(port:integer;n:integer):Boolean;stdcall;export;external 'KQDLL.dll';
function ClearData(port:integer;n:integer):Boolean;stdcall;export;external 'KQDLL.dll';
implementation
end.
在调用:
procedure Tm_updata1.btn_CollectClick(Sender: TObject);
label loop,loop1;
var
n,i,machineId,bunchId:Integer;
s:string;
begin
ListBox2.Items.Clear;
n:=0;
S:='';
i:=0;
machineId:=ComboBox1.ItemIndex+1;
bunchId:=ComboBox2.ItemIndex+1;
n:=GetDataNum(bunchId,machineId);
if n<>-1 then
begin
for i:=0 to n-1do
GetData(s);
ListBox2.Items.Strings:=s;
end;
可以读到总条数,但再次执行时出错,请那位高手帮忙小弟。小弟实为感激不尽。
About kqdll.dll
在此动态库中共包含有8个函数,以下一个介绍其调用方法及参数说明:
1、long : GetDataNum(int port,int n) port为计算机端口号,n为考勤机机号;
2、bool : GetData(char *w) : char *w 为一个空的字符串值,长度为20以上;
两函数相辅作用,GetDataNum为返回考勤机机内记录总数(返回long类型值),
GetData为遂条取得机内数据(返回bool表示是否成功取得每一笔数据);例VB:
Private Sub Command1_Click()
Dim s As String * 23, n As Long, i As Long
Text1.Text = ""
n = FastGetDataNum(1, 1) //GetDataNum(int port,int n)
If n = -1 then
MsgBox "ERROR!"
Exit Sub
End If
ProgressBar1.Max = n
i = 1
Me.MousePointer = 11
MsgBox s
do
While FastGetData(s) //GetData(char *w)
ProgressBar1.Value = i
i = i + 1
Text1.Text = Text1.Text + s + vbCrLf
Text1.SelStart = Len(Text1.Text)
Me.Refresh
Loop
Me.MousePointer = 0
MsgBox "OK!"
End Sub
3、long: FastGetDataNum(int port,int n) port为端口号,n 为考勤机机号
4、bool: FastGetData(char *d) d为一个空的字符串值,长度大于20
同样这两个函数也为下载函数,用法同上,不同的是上两个函数下载函数偏慢,
这两个下载函数速度快得多。
5、bool: CheckTime(int port,int n) port为端口号,n 为考勤机机号
6、bool: ClearData(int port,int n) port为端口号,n 为考勤机机号
这两个函数分别为设置考勤机时间和清除机器内的记录,都返加bool值,表
示是否操作成功.
7、bool: SetOpenCard(int port,int n,unsigned char *kh) port为端口号,n为考勤机机号,kh为一个5位的字符串
8、bool: DelOpenCard(int port,int n,unsigned char *kh)
这两个函数只适用于SKM2000型的考勤门禁一体机或门禁机,SetOpenCard为赋予一张卡开门的权限,kh为该张卡
的后五位ABA号码,DelOpenCard为取消开门卡的开门权限,两函数都返加bool值,表操作是否成功.
以下是各函数在VB中的声明方法:
1、private declare function GetDataNum lib "kqdll.dll"
(byval port as integer,byval n as integer) as long
2、private declare function GetData lib "kqdll.dll"
(byval s as string) as boolean
3、private declare function FastGetDataNum lib "kqdll.dll"
(byval port as integer,byval n as integer) as long
4、private declare function FastGetData lib "kqdll.dll"
(byval s as string) as boolean
5、private declare function CheckTime lib "kqdll.dll"
(byval port as integer,byval n as integer) as boolean
6、private declare function ClearData lib "kqdll.dll"
(byval port as integer,byval n as integer) as boolean
7、private declare function SetOpenCard lib "kqdll.dll"
(ByVal port As Long, ByVal jh As Long, ByVal kh As String) As Boolean
7、private declare function DelOpenCard lib "kqdll.dll"
(ByVal port As Long, ByVal jh As Long, ByVal kh As String) As Boolean
GetData与FastGetData的仅是速度上的区别,FastGetData比GetData快一倍
但FastGetData不支持早期版本考勤机。
用FastGetData或GetData取得的记录格式说明如下:
记录格式为:00000000:0000000000000
前六位为卡号,00:00为时间,再八位为时间如20010806,再二两位为机
器编号,最后一位为类型标识
类型标识:1为中途外入,2为中途外出,3为门禁读头读卡,0为正常读卡
我在DELPHI中声名:
unit OneSub;
interface
uses Dialogs,DBTables,Registry,Controls,SysUtils,Windows,Forms,Classes;
function GetDataNum(port:integer;n:integer):integer;stdcall;export;external 'KQDLL.dll';
function GetData(s:string):Boolean;stdcall;export;external 'KQDLL.dll';
function FastGetDataNum(port:integer;n:integer):integer;stdcall;export;external 'KQDLL.dll';
function FastGetData(schar):Boolean;stdcall;export;external 'KQDLL.dll';
function CheckTime(port:integer;n:integer):Boolean;stdcall;export;external 'KQDLL.dll';
function ClearData(port:integer;n:integer):Boolean;stdcall;export;external 'KQDLL.dll';
implementation
end.
在调用:
procedure Tm_updata1.btn_CollectClick(Sender: TObject);
label loop,loop1;
var
n,i,machineId,bunchId:Integer;
s:string;
begin
ListBox2.Items.Clear;
n:=0;
S:='';
i:=0;
machineId:=ComboBox1.ItemIndex+1;
bunchId:=ComboBox2.ItemIndex+1;
n:=GetDataNum(bunchId,machineId);
if n<>-1 then
begin
for i:=0 to n-1do
GetData(s);
ListBox2.Items.Strings:=s;
end;
可以读到总条数,但再次执行时出错,请那位高手帮忙小弟。小弟实为感激不尽。