zoukankan      html  css  js  c++  java
  • 关于开钱箱(不是用螺丝刀子开)

    //开钱箱:桑达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;

  • 相关阅读:
    学校的破网,你别再掉了
    PhotoShop SDK的获取
    我的C++博客开张了
    一个新的嵌入式门户
    试用Bloglines.com
    PhotoShop的插件体系
    VB6 to VB.NET Migration Guide Community Preview #4
    看看Microsoft都买了些什么
    Borland CTO辞职
    PhotoShop插件的开发
  • 原文地址:https://www.cnblogs.com/HaiHong/p/5217443.html
Copyright © 2011-2022 走看看