-
Oct 19th, 2014, 12:00 PM
#1
Thread Starter
New Member
Printing Protection
Basically I want my administrator user (ONLY) to be able to set a password that any user is prompted for whenever they send a job to any printer on the computer/network.
Obviously this will require the program to run at startup/login (but to be minimised into the taskbar) and monitor the status of print jobs. When a user sends a document to a printer, the program will detect this, pause the print job and prompt the user for the password. If the password is correct, the print job is resumed/completed and if the password is incorrect, the user has the option to either cancel the print or try the password again.
I understand it is a lot I am asking for and I am trying my best to figure this out myself but I don't even know where to start. Any help will be greatly appreciated.
-
Oct 19th, 2014, 08:50 PM
#2
Hyperactive Member
Re: Printing Protection
Hi
You need to watch the print queue. When a job is found, pause it. Throw up your password screen, if the password is correct, resume the print job from the queue, otherwise delete it.
There's some info here which may get you started: https://social.msdn.microsoft.com/Fo...um=Vsexpressvb
Or there are lots of posts in Google if you seach for vb.net monitor print queue/pause print queue and so on.
Hopefully that will get you started.
Why do today what you can tomorrow...
-
Oct 20th, 2014, 01:27 AM
#3
Re: Printing Protection
You can detect and manage the printers using this component...I'd suggest running it on the server(s) as the admin user and then reducing user's access rights to administer the printers so they cannot bypass it.
-
Oct 21st, 2014, 11:44 AM
#4
Thread Starter
New Member
Re: Printing Protection
Thanks for the help, I couldn't get the first suggestion to work, I had errors everywhere. I have no errors on the PrintQueueWatch but when I go to debug the program, I get this error: ...any suggestions here??
EDIT: I've discovered that it was this line
Code:
pmon.AddPrinter(p.PrinterName)
that was causing the problem, removing it seems to have fixed the problem. Is this an important line of code??
Also, I want to create an if statement that says IF a print job is added THEN pause the print and open another form. How is this possible with the PrintQueueWatch Component?
Last edited by danny_cc; Oct 21st, 2014 at 01:07 PM.
-
Oct 22nd, 2014, 01:56 AM
#5
Re: Printing Protection
Click on the View Detail link to see what the real underlying issue is.
pmon.AddPrinter(p.PrinterName) is important - it adds the printer to the list of printers being monitored.
There is a property - PauseAllPrintJobs that automatically pauses any jobs as they are added to the printer if the user running the program has rights to so do
-
Oct 22nd, 2014, 04:04 PM
#6
Thread Starter
New Member
Re: Printing Protection
Originally Posted by Merrion
Click on the View Detail link to see what the real underlying issue is.
pmon.AddPrinter(p.PrinterName) is important - it adds the printer to the list of printers being monitored.
There is a property - PauseAllPrintJobs that automatically pauses any jobs as they are added to the printer if the user running the program has rights to so do
The problem was "{"An error occurred creating the form. See Exception.InnerException for details. The error is: The method or operation is not implemented."}" as I mentioned in a previous post, I have a limited knowledge of VB (with just AS level experience) so I really do apologise for being such a bug and asking for help but I really do appreciate it.
How would I use the PauseAllPrintJobs (again sorry for all of the questions).
-
Oct 28th, 2014, 01:45 PM
#7
Thread Starter
New Member
Re: Printing Protection
Anyone?? I just can't get my head around this error
-
Oct 29th, 2014, 05:25 AM
#8
Re: Printing Protection
PauseAllPrintJobs example (from the source documentation) :-
vbnet Code:
Private WithEvents pmon As New PrinterMonitorComponent Public Sub New() MyBase.New() ' This call is required by the Windows Form Designer. InitializeComponent() ' Monitor all the installed printers For Each p As String In System.Drawing.Printing.PrinterSettings.InstalledPrinters pmon.AddPrinter(p) pmon.PrinterInformation(p).PauseAllNewJobs = True Next p End Sub Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As PrintJobEventArgs) Handles pmon.JobAdded With CType(e, PrintJobEventArgs) Trace.WriteLine("New job added " & .PrintJob.UserName) End With End Sub
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
|