Solved

How I can control the Print queue?

Posted on 2001-06-17
10
205 Views
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.









0
Comment
Question by:mohd130
  • 8
  • 2
10 Comments
 

Author Comment

by:mohd130
ID: 6199411
Please as soon as possible

Many Thanks
0
 

Author Comment

by:mohd130
ID: 6199412
Please as soon as possible

Many Thanks
0
 
LVL 7

Expert Comment

by:q2eddie
ID: 6199457
0
 

Author Comment

by:mohd130
ID: 6199514
thank you Q2eddie

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

0
 

Author Comment

by:mohd130
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??

0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 7

Accepted Solution

by:
q2eddie earned 300 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

#Links
1. "bas for 13 Windows dll's"
http://www.planet-source-code.com/xq/ASP/txtCodeId.7927/lngWId.1/qx/vb/scripts/ShowCode.htm

Bye. -e2
0
 

Author Comment

by:mohd130
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 :

Type JOB_INFO_1
  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.

0
 

Author Comment

by:mohd130
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.

Moh'd
0
 

Author Comment

by:mohd130
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.

Moh'd
0
 

Author Comment

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

It's not working.

Please help again
Mo
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now