Results 1 to 8 of 8

Thread: Printing Protection

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2011
    Posts
    11

    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.

  2. #2
    Hyperactive Member
    Join Date
    Dec 2000
    Location
    Sydney
    Posts
    311

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

  3. #3
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    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.

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2011
    Posts
    11

    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: Name:  error.jpg
Views: 157
Size:  23.0 KB...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.

  5. #5
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    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

  6. #6

    Thread Starter
    New Member
    Join Date
    Mar 2011
    Posts
    11

    Re: Printing Protection

    Quote Originally Posted by Merrion View Post
    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).

  7. #7

    Thread Starter
    New Member
    Join Date
    Mar 2011
    Posts
    11

    Re: Printing Protection

    Anyone?? I just can't get my head around this error

  8. #8
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Re: Printing Protection

    PauseAllPrintJobs example (from the source documentation) :-

    vbnet Code:
    1. Private WithEvents pmon As New PrinterMonitorComponent
    2.  
    3.     Public Sub New()
    4.         MyBase.New()
    5.  
    6.         ' This call is required by the Windows Form Designer.
    7.         InitializeComponent()
    8.  
    9.         ' Monitor all the installed printers
    10.         For Each p As String In System.Drawing.Printing.PrinterSettings.InstalledPrinters
    11.             pmon.AddPrinter(p)
    12.             pmon.PrinterInformation(p).PauseAllNewJobs = True
    13.         Next p
    14.  
    15.     End Sub
    16.  
    17.     Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As PrintJobEventArgs) Handles pmon.JobAdded
    18.  
    19.         With CType(e, PrintJobEventArgs)
    20.             Trace.WriteLine("New job added " & .PrintJob.UserName)
    21.         End With
    22.  
    23.     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
  •  



Click Here to Expand Forum to Full Width