关于开钱箱(不是用螺丝刀子开)

//开钱箱:桑达CR3000A的QXDLL.dll有两个外部接口:opend(int t1,int t2,unsigned port)。其中t1,t2分别为延时t1,t2毫秒;port为十六进制的
//端口地址。实现的功能是先往该端口送数据7,然后延时t1毫秒,再送数据0,然后再延时t2毫秒。
Function OpenMoneyBoxCR3000(nInPortAddress:integer=-1):Boolean;
type _openCr3K=function (t1,t2,port:integer):integer; stdcall; //External 'qxdll.dll' Name 'opend' ;
Var H:tHandle; P:tFarProc; V:TOsVersionInfoA; s:String;
Begin
Result:=False;
Try
V.dwOSVersionInfoSize:=SizeOf(TOsVersionInfoA);
If Not GetVersionEx(V) then Exit;
if V.dwPlatformId>=Windows.VER_PLATFORM_WIN32_NT then s:='cr3000nt.dll' else s:='cr30009X.dll';
if not GetDynaDllProc(s, 'opend',H,P) then Begin
Messagebox(0,'调用开钱箱opend部分出错!终止','OpenMoneyBoxCR3000.openD Error',32);
Exit;
End;
Result:=_openCr3K(p)(500, 500, nInPortAddress)=0;
Finally
FreeLibrary(H);
End;
end;
//开钱葙
Function OpenMoneyBox(sMoneyBoxPort:String; nPortAddress:integer=0):Boolean;
Var PrnFileName: TextFile;
Begin
Result:=False;
Try
if trim(upperCase(sMoneyBoxPort))='CR3000' then begin //桑达CR3000A
result:=openMoneyBoxCr3000(nPortAddress);
exit;
end;
//
Try
Assignfile(PrnFileName,sMoneyBoxPort);
Rewrite(PrnFileName);
//
Write( PRNFileName, sMoneyBoxOpenCommand );
//
Result:=True;
Finally
Try CloseFile(PRNFileName) Except End;
End;
Except
On x:Exception do
Raise Exception.Create('[OpenMoneyBox]开钱箱'+sMoneyBoxPort+'出错!请检查连接,没有钱箱请将系统设置的“钱箱接口”选择成空的。'#13+x.message);
End;
End;

 

转载于:https://www.cnblogs.com/HaiHong/p/5217443.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值