Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


How I can control the Print queue?

Posted on 2001-06-17
Medium Priority
Last Modified: 2010-05-02
Dear All....

I need to build an application to control our network printer by number of pages for each user then if any user exceed his limit the program should delete his printing job.

About 70% of My application now is ready it's counting number of pages printed,saveing all the printer jobs for each user in a database.

What I need is a code to delete or cancel any printer jobs from the print queue if the owner of this job is exceeding his paper limit?

Your help is realy appreciated.

Question by:mohd130
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 2

Author Comment

ID: 6199411
Please as soon as possible

Many Thanks

Author Comment

ID: 6199412
Please as soon as possible

Many Thanks

Expert Comment

ID: 6199457
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 6199514
thank you Q2eddie

It's a nice program but only for WNT and 2000 I need the program to run with W98.


Author Comment

ID: 6199522
By using the function SetJob, In MSDN it's written that:

The SetJob function pauses, resumes, cancels, or restarts a print job on a specified printer. You can also use the SetJob function to set print job parameters, such as the print job priority and the document name.

BOOL SetJob(
  HANDLE hPrinter,  // handle to printer object
  DWORD JobId,      // print job identifier
  DWORD Level,      // specifies type of job information structure
  LPBYTE  pJob,     // pointer to job information structure
  DWORD Command     // job command value

But how I can use it in VB??


Accepted Solution

q2eddie earned 1200 total points
ID: 6199540
Hi, again.

I think the declaration is like this:

Declare Function SetJob _
    Lib "winspool.drv" _
    Alias "SetJobA" ( _
        ByVal hPrinter As Long, ByVal JobId As Long, _
        ByVal Level As Long, pJob As Byte, _
        ByVal command As Long) _
    As Long

1. "bas for 13 Windows dll's"

Bye. -e2

Author Comment

ID: 6199615
I thing it's right declaration, only I have a problrm with the parameter:

PJob as byte

I define Job_info_1 as :

  JobId        As Long
  pPrinterName As Long
  pMachineName As Long
  pUserName    As Long
  pDocument    As Long
  pDatatype    As Long
  pStatus      As Long
  Status       As Long
  Priority     As Long
  Position     As Long
  TotalPages   As Long
  PagesPrinted As Long
  Submitted    As SYSTEMTIME
End Type

or do you have any example that used this function.


Author Comment

ID: 6199626
I get It :):):):):):):)

I just define avariable of Byte and send it with the function argument with the commend &H4 to delete the printer job and it was success.

Many Thanks q2eddi
I'll accept your comment as answer.


Author Comment

ID: 6199647
I get It :):):):):):):)

I just define avariable of Byte and send it with the function argument with the commend &H4 to delete the printer job and it was success.

Many Thanks q2eddi
I'll accept your comment as answer.


Author Comment

ID: 6199649
Sorry it seems that there is something wrong??

It's not working.

Please help again

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question