API函数参数的问题

longspring 2012-04-01 03:19:25
指纹考勤机有个函数是设定设备时间的,

Public Declare Function FK_SetDeviceTime Lib "FKAttend" (ByVal nHandleIndex As Long, ByVal nDateTime As Date) As Long

VB中只要传入now就可以设置

但是在VFP中不知道怎么来定义nDateTime这个参数,我想把当前时间datetime()传入,试了很多转换的方法都不行

Declare integer FK_SetDeviceTime IN FKAttend.dll integer,string &&最后一个参数不知道设置成string还是integer该如何调用。
...全文
160 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
longspring 2012-04-01
  • 打赏
  • 举报
回复
可以了,刚才我也试过用integer的,应该是要设置双精度的,还是对这方面的知识太缺乏了,太感谢了。
都市夜猫 2012-04-01
  • 打赏
  • 举报
回复
那再试试:
*-- vfp9 代码
nn = date() - date(1900,1,1)+1 + seconds()/86400

Declare integer FK_SetDeviceTime IN FKAttend.dll integer, DOUBLE
? FK_SetDeviceTime(1, nn)
longspring 2012-04-01
  • 打赏
  • 举报
回复
你这个方法我试过的,虽然执行是成功的,但是在考勤机上显示的结果是错的,显示2155-12-30 00:00:00
我随便传入一个字符型的数据都会显示这个结果,应该是DLL对错误传入数据的默认设置结果,还是请楼主分析下,是不是要进行转换什么的?

上次你给解决的那个问题是从设备上读取Date,然后我也是按string来读,然后通过Dtot({^1899.12.30}+int(ctobin(f4,'8')))+(ctobin(f4,'8')%1)*86400可以得到正确的值,这次是反过来了。

都市夜猫 2012-04-01
  • 打赏
  • 举报
回复
试试:
*-- vfp9 代码
nd = date() - date(1900,1,1) + 1
ns = seconds() / 86400
cc = bintoc(nd+ns, 'B')

Declare integer FK_SetDeviceTime IN FKAttend.dll integer, string
? FK_SetDeviceTime(1, cc)

2,749

社区成员

发帖
与我相关
我的任务
社区描述
VFP,是Microsoft公司推出的数据库开发软件,用它来开发数据库,既简单又方便。
社区管理员
  • VFP社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧