|
-
Dec 12th, 2000, 03:12 AM
#1
Thread Starter
Junior Member
hi there.
thanks for looking at this post again. i have tried everything to use the api call to set the printer to a state of 'paused', with no luck whatsoever. here is the code that i am using, could you take a look at it and give me your comments.
really appreciated.
'Variable Declarations
Dim longbuffer() As Long ' resizable array receives information from the function
Dim PrintInfo() As PRINTER_INFO_2 ' values inside longbuffer() will be put into here
Dim numbytes As Long ' size in bytes of longbuffer()
Dim numneeded As Long ' receives number of bytes necessary if longbuffer() is too small
Dim c As Integer ' counter variable
Dim Retval, ret As Long ' return values
Dim numprinters As Long ' receives number of printers found
Dim PrinterStruct As PRINTER_DEFAULTS
Dim hPrinter As Long
Dim PrinterName As String
numbytes = 3076
ReDim longbuffer(0 To numbytes / 4) As Long
Retval = EnumPrinters(PRINTER_ENUM_LOCAL, "", 2,longbuffer_ _(0), numbytes, numneeded, numprinters)
If Retval = 0 Then
numbytes = numneeded
ReDim longbuffer(0 To numbytes / 4) As Long
Retval = EnumPrinters(PRINTER_ENUM_LOCAL, "", 2,_
_longbuffer(0), numbytes, numneeded, numprinters)
End If
ReDim PrintInfo(0 To numprinters - 1) As PRINTER_INFO_2
For c = 0 To numprinters - 1
PrintInfo(c).pPrinterName = Space(lstrlen(longbuffer(4 * c_
_+ 1)))
PrintInfo(c).Status = longbuffer(4 * c + 18)
'Initialize the Printer structure
PrinterStruct.pDatatype = vbNullString
PrinterStruct.pDevMode.dmSize = Len(PrinterStruct.pDevMode)
PrinterStruct.DesiredAccess = PRINTER_ALL_ACCESS
Retval = OpenPrinter("HP Deskjet 690C", hPrinter, _
_PrinterStruct)
'-----This is where the problem arises, and it does nothing!
ret = SetPrinter(hPrinter, 0, 0, PRINTER_CONTROL_PAUSE)
Retval = CloseHandle(hPrinter) ' this does not work either!
Thanks again.
Looking forward to your expert help.
andrew
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|