The following routine opens a cash drawer using VB.Net. Most cash drawers are attached to a recipt printer through what looks to be a phone jack. To open the cash drawer the POS software must send "control codes" to your printer which will then send an impulse to the cash drawer to pop it open. The problem is that the POS software has to know the proper control code to send to the receipt printer that you are using. It seems like every receipt printer uses a different code. You can find the "open cash drawer" code by looking in the printer's manual, calling the printer's manufacturer, or it may be listed at the bottom of this page.
Code:
Public Sub open_cashdrawer() Dim intFileNo As Integer = FreeFile() FileOpen(1, "c:\escapes.txt", OpenMode.Output) PrintLine(1, Chr(27) & "p" & Chr(0) & Chr(25) & Chr(250)) FileClose(1) Shell("print /d:lpt1 c:\escapes.txt", vbNormalFocus) End Sub
Is this drawer similar to POS Cash Drawer ?
ReplyDelete