 |
| File Info |
| Version : |
1.0.0 |
| Support Topic : |
Click Here (0 comments) |
| Demo : |
N/A |
| Screenshot : |
N/A |
| Post Date : |
Apr 24, 2004 |
| Last Edit Date : |
Apr 24, 2004 |
| Language Version : |
VB6 |
| Current Rating : |
 |
|
| Author Info |
|
|
|
| Code Description |
This is Visual Basic Program can be used to
print directly to the printer port.
It is very fast!
Most Probably can be used Super Markets for
customer satisfcation. They don't have to
wait for the their bills.
|
| Download Info |
|
|
| User Feedback |
|
|
|
| VB Code |
#If Win32 Then
Public Type DOC_INFO_1
pDocName As String
pOutputFile As String
pDatatype As String
End Type
#End If
#If Win32 Then
Public Declare Function OpenPrinter& Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, ByVal pDefault As Long) Public Declare Function StartDocPrinter& Lib "winspool.drv" Alias "StartDocPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, pDocInfo As DOC_INFO_1)
Public Declare Function StartPagePrinter& Lib "winspool.drv" (ByVal hPrinter As Long)
Public Declare Function WritePrinter& Lib "winspool.drv" (ByVal hPrinter As Long, pBuf As Any, ByVal cdBuf As Long, pcWritten As Long)
Public Declare Function EndDocPrinter& Lib "winspool.drv" (ByVal hPrinter As Long)
Public Declare Function EndPagePrinter& Lib "winspool.drv" (ByVal hPrinter As Long)
Public Declare Function ClosePrinter& Lib "winspool.drv" (ByVal hPrinter As Long)
#End If
Public Function ToPrinter(ByVal PrnData As String, ByVal PrinterDeviceName As String)
Dim hPrinter&
Dim jobid&
Dim res&
Dim written&
Dim printdata$
Dim docinfo As DOC_INFO_1
res& = OpenPrinter(PrinterDeviceName, hPrinter, 0)
If res = 0 Then
MsgBox "Unable to open the printer"
Exit Function
End If
docinfo.pDocName = "MyDoc"
docinfo.pOutputFile = vbNullString
docinfo.pDatatype = vbNullString
jobid = StartDocPrinter(hPrinter, 1, docinfo)
Call StartPagePrinter(hPrinter)
printdata$ = PrnData & vbLineFeed
Call WritePrinter(hPrinter, ByVal printdata$, Len(printdata$), written)
Call EndPagePrinter(hPrinter)
Call EndDocPrinter(hPrinter)
Call ClosePrinter(hPrinter)
End Function
|
|
|
|
 |
 |