Enum Jobs printer

Thread Solved

Join Date: Nov 2007
Posts: 63
Reputation: Sawamura is an unknown quantity at this point 
Solved Threads: 6
Sawamura's Avatar
Sawamura Sawamura is offline Offline
Junior Poster in Training

Enum Jobs printer

 
0
  #1
Apr 4th, 2008
hi masters...
i want to get jobs in printer queue...
i didn't have idea to do this. please help me.
any help will be appreciated.
thanks before.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Enum Jobs printer

 
6
  #2
Apr 4th, 2008
try this following code :
  1. Private Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, pDefault As Any) As Long
  2. Private Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
  3. Private Declare Function EnumJobs Lib "winspool.drv" Alias "EnumJobsA" (ByVal hPrinter As Long, ByVal FirstJob As Long, ByVal NoJobs As Long, ByVal Level As Long, pJob As Any, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
  4. Private Sub Form_Load()
  5.  
  6. Dim hPrinter As Long, lNeeded As Long, lReturned As Long
  7. Dim lJobCount As Long
  8. OpenPrinter Printer.DeviceName, hPrinter, ByVal 0&
  9. EnumJobs hPrinter, 0, 99, 1, ByVal 0&, 0, lNeeded, lReturned
  10. If lNeeded > 0 Then
  11. ReDim byteJobsBuffer(lNeeded - 1) As Byte
  12. EnumJobs hPrinter, 0, 99, 1, byteJobsBuffer(0), lNeeded, lNeeded, lReturned
  13. If lReturned > 0 Then
  14. lJobCount = lReturned
  15. Else
  16. lJobCount = 0
  17. End If
  18. Else
  19. lJobCount = 0
  20. End If
  21. ClosePrinter hPrinter
  22. MsgBox "Jobs in printer queue: " + CStr(lJobCount), vbInformation
  23. End Sub
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Enum Jobs printer

 
2
  #3
Apr 4th, 2008
don't forget to give a feedback
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 63
Reputation: Sawamura is an unknown quantity at this point 
Solved Threads: 6
Sawamura's Avatar
Sawamura Sawamura is offline Offline
Junior Poster in Training

Re: Enum Jobs printer

 
0
  #4
Apr 4th, 2008
oh.. thank you very much jx_man...
it working like a charm.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Enum Jobs printer

 
0
  #5
Apr 4th, 2008
yeah..You're welcome friend
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC