VERSION 5.00 Object = "{CCB90040-B81E-11D2-AB74-0040054C3719}#1.0#0"; "OPOSCashDrawer.ocx" Begin VB.Form frmMain Caption = "Form1" ClientHeight = 3090 ClientLeft = 60 ClientTop = 450 ClientWidth = 4680 LinkTopic = "Form1" ScaleHeight = 3090 ScaleWidth = 4680 StartUpPosition = 3 '窗口缺省 Begin OposCashDrawer_CCOCtl.OPOSCashDrawer obj Left = 960 OleObjectBlob = "frmMain.frx":0000 Top = 1080 End End Attribute VB_Name = "frmMain" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long) '由于OposCCOs-1_12_901setup.exe驱动与delphi不兼容,缺少驱动属性 '所以钱箱驱动改为由VB编写 'add by jzh 2012-07-24 Private Sub Form_Load() Dim rc As Integer '打开钱箱设备接口,并返回打开结果 rc = obj.Open("CD") If rc <> 0 Then MsgBox ("钱箱设备 CD 无法打开!") End If '声明设备 obj.ClaimDevice (5000) '激活设备 obj.DeviceEnabled = True '打开钱箱 rc = obj.OpenDrawer() Sleep (100) '解除设备 obj.DeviceEnabled = False '释放设备 rc = obj.ReleaseDevice() '退出 Unload Me End Sub