Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print job information 1

Status
Not open for further replies.

MrChopper

Programmer
Aug 11, 2004
20
US
Hi,

Is there some way I can get information about a print job (Description, username, page count, etc.) before it's pushed through the queue? I'd like to be able to pause a print job if my app detects it's over a certain page count. If it's under, it can go right through the queue. I can't seem to find too much information about print server availablities in VB.NET (2005). Any help is appreciated!
 
Thanks for the info! Is it possible to pause/resume print jobs from VB too?
 
Try doing a better search in the help. The info is there, you just have to dig for it. Try searching on: print spooler. MSDN returns 100 hits, local help has 500.

Also do a google search. There is a ton of info available, you just have to look.
 
Personally, I start out with a Google search. I find that it gives a better result. Just make sure you add Visual Basic to your search parameters to narrow the search.

Also, look though the FAQ at the bottom of the page. I didn't go through them, but it looked liek someone else was askign the same question
 
Okay thanks for the tips guys. I found alot of good examples and am trying to implement them. I'm able to "open" the printer, but I'm having trouble with the enumjobs API call. Here's my function declaration:

<DllImport("winspool.drv", EntryPoint:="EnumJobsA", setlasterror:=True, CharSet:=CharSet.Ansi, exactspelling:=True, CallingConvention:=CallingConvention.StdCall)> Public Shared Function EnumJobs(ByVal hPrinter As Long, ByVal FirstJob As Long, ByVal NoJobs As Long, ByVal Level As Long, ByVal LpByte As Long, ByVal cbuf As Long, ByVal pcbNeeded As Long, ByVal bcReturned As Long) As Long
End Function

And in my main, here are my function calls to open the printer and get the jobs in the queue:

If PrintJob.OpenPrinter(dummy, printer, defaults) Then
MsgBox("worked!!!")
MsgBox(PrintJob.EnumJobs(printer, 0, 99, 2, test, 0, pcbNeeded, bcReturned))

Dummy is declared as a string, and test is declared as long. The problem is, I'm getting the following error:

PInvokeStackImbalance was detected
Message: A call to PInvoke function 'PrinterQueueWatch!PrinterQueueWatch.PrintJob::EnumJobs' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

Let me know if any more info is needed. Thanks for the assistance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top