Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Windows Forms
  4. How To Detect The person who click the print option in any document?????

How To Detect The person who click the print option in any document?????

Scheduled Pinned Locked Moved Windows Forms
helpdesigntutorialquestioncareer
18 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M manjari kar

    yes, u got my point.now plz helpme and give me the right path. my code is like this.and in this code after print dialog when a person clicks ok then my dialog is comming and asking for username and password.means m able to block the job after going to the print spool.help me that how i will detect before going to the print spool. private void timer1_Tick(object sender, EventArgs e) { PrintServer myPrintServer = new PrintServer(@"HP LaserJet P2010 Series PCL 5e"); PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues(); foreach (PrintQueue pq in myPrintQueues) { pq.Refresh(); PrintJobInfoCollection jobs = pq.GetPrintJobInfoCollection(); foreach (PrintSystemJobInfo job in jobs) { if (job.Submitter == "gyana.manjarikar") { job.Pause(); } if (true) { //MessageBox.Show(job.Name.ToString()); this.Show(); } else this.Hide(); } } } private void btnlogin_Click(object sender, EventArgs e) { int copies=10; this.Opacity = 50; PrintServer myPrintServer = new PrintServer(@"HP LaserJet P2010 Series PCL 5e"); PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues(); foreach (PrintQueue pq in myPrintQueues) { pq.Refresh(); PrintJobInfoCollection jobs = pq.GetPrintJobInfoCollection(); foreach (PrintSystemJobInfo job in jobs) { //if (txtUserName.Text == "aaa" && txtPassword.Text == "bbb" && copies <= 10) //{ // job.Restart(); //} if (job.Submitter == "gyana.manjarikar") { if (txtUserName.Text == "aa" && txtPassword.Text == "bb" && copies <= 10) { timer1.Dispose(); job.Resume(); this.Hide(); } else { lblErrormsg.Text = "Invalid

    M Offline
    M Offline
    Mycroft Holmes
    wrote on last edited by
    #6

    All right, I tried to make it simple for you, I pointed out that I have no idea how you are going to achieve this and even called you an idiot for attempting it. And still you come back, this time with code. This proves you are not a troll, it does not change the fact that this is a stupid requirement. I won't help you as I have better things to do, theres an ant crawling up the wall, that will be more interesting than debating this idiotic subject with you. Good luck pal, you're going to need it!

    Never underestimate the power of human stupidity RAH

    L 1 Reply Last reply
    0
    • M manjari kar

      yes, u got my point.now plz helpme and give me the right path. my code is like this.and in this code after print dialog when a person clicks ok then my dialog is comming and asking for username and password.means m able to block the job after going to the print spool.help me that how i will detect before going to the print spool. private void timer1_Tick(object sender, EventArgs e) { PrintServer myPrintServer = new PrintServer(@"HP LaserJet P2010 Series PCL 5e"); PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues(); foreach (PrintQueue pq in myPrintQueues) { pq.Refresh(); PrintJobInfoCollection jobs = pq.GetPrintJobInfoCollection(); foreach (PrintSystemJobInfo job in jobs) { if (job.Submitter == "gyana.manjarikar") { job.Pause(); } if (true) { //MessageBox.Show(job.Name.ToString()); this.Show(); } else this.Hide(); } } } private void btnlogin_Click(object sender, EventArgs e) { int copies=10; this.Opacity = 50; PrintServer myPrintServer = new PrintServer(@"HP LaserJet P2010 Series PCL 5e"); PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues(); foreach (PrintQueue pq in myPrintQueues) { pq.Refresh(); PrintJobInfoCollection jobs = pq.GetPrintJobInfoCollection(); foreach (PrintSystemJobInfo job in jobs) { //if (txtUserName.Text == "aaa" && txtPassword.Text == "bbb" && copies <= 10) //{ // job.Restart(); //} if (job.Submitter == "gyana.manjarikar") { if (txtUserName.Text == "aa" && txtPassword.Text == "bb" && copies <= 10) { timer1.Dispose(); job.Resume(); this.Hide(); } else { lblErrormsg.Text = "Invalid

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #7

      You're not going to be able to do this using all-.NET code. I don't know the specifics of how to do it, but you're going to have to basically replace the system's print dialog to do what you want. This is FAR from a trivial task. You'll need very advanced knowledge of Windows internals and COM programming, along with some C++. Why? Because Windows Security does not have any facilities in it to do what you want. Assigning a seperate password to a resource is a very inefficient method of trying to protect that resource. Personally, I think you're wasting your time trying to do this. Windows Security is made in such a way that users have a single sign-on and don't have to worry about "yet another password" to remember to access any resource. The permissions to users and groups of users are assigned to the user based on their login token, this includes accessing shared devices such as printers. Your current method does not stop a print job from running. Since the job is already being spooled when your code figures out it is there, the print job has already started happening. The only thing you can do is pause the printer, which pauses ALL print jobs going to it, even the ones by other users who have supposedly put in the proper password. This is easily defeated because the user can just resume the printer to get around your password.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      M 1 Reply Last reply
      0
      • M Mycroft Holmes

        All right, I tried to make it simple for you, I pointed out that I have no idea how you are going to achieve this and even called you an idiot for attempting it. And still you come back, this time with code. This proves you are not a troll, it does not change the fact that this is a stupid requirement. I won't help you as I have better things to do, theres an ant crawling up the wall, that will be more interesting than debating this idiotic subject with you. Good luck pal, you're going to need it!

        Never underestimate the power of human stupidity RAH

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #8

        I recommend either McAfee or John's kerosene. :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


        1 Reply Last reply
        0
        • D Dave Kreskowiak

          You're not going to be able to do this using all-.NET code. I don't know the specifics of how to do it, but you're going to have to basically replace the system's print dialog to do what you want. This is FAR from a trivial task. You'll need very advanced knowledge of Windows internals and COM programming, along with some C++. Why? Because Windows Security does not have any facilities in it to do what you want. Assigning a seperate password to a resource is a very inefficient method of trying to protect that resource. Personally, I think you're wasting your time trying to do this. Windows Security is made in such a way that users have a single sign-on and don't have to worry about "yet another password" to remember to access any resource. The permissions to users and groups of users are assigned to the user based on their login token, this includes accessing shared devices such as printers. Your current method does not stop a print job from running. Since the job is already being spooled when your code figures out it is there, the print job has already started happening. The only thing you can do is pause the printer, which pauses ALL print jobs going to it, even the ones by other users who have supposedly put in the proper password. This is easily defeated because the user can just resume the printer to get around your password.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008

          M Offline
          M Offline
          manjari kar
          wrote on last edited by
          #9

          thanks lot for ur great response.i will try to do.

          How i will design a a form in windows service to print a document.

          D 1 Reply Last reply
          0
          • M manjari kar

            thanks lot for ur great response.i will try to do.

            How i will design a a form in windows service to print a document.

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #10

            manjari kar wrote:

            How i will design a a form in windows service

            You don't. Services should not expose a user interface.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            M 1 Reply Last reply
            0
            • D Dave Kreskowiak

              manjari kar wrote:

              How i will design a a form in windows service

              You don't. Services should not expose a user interface.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007, 2008

              M Offline
              M Offline
              manjari kar
              wrote on last edited by
              #11

              any ways can i customise the print dialog of the system,means i want to replace comdlg32.dll to system 32 or win 32.by invoking.or if any other method to overriding comdlg32.dll then plz tell me.nw for this requirement i m thinking to customise the stanard print dialog .so how i will do.plz help me.

              How i will design a a form in windows service to print a document.

              D 1 Reply Last reply
              0
              • M manjari kar

                any ways can i customise the print dialog of the system,means i want to replace comdlg32.dll to system 32 or win 32.by invoking.or if any other method to overriding comdlg32.dll then plz tell me.nw for this requirement i m thinking to customise the stanard print dialog .so how i will do.plz help me.

                How i will design a a form in windows service to print a document.

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #12

                manjari kar wrote:

                i want to replace comdlg32.dll

                You can't do that. The next time anyone installs a piece of software or MS releases a patch, it'll overwrite or replace what you put in.

                manjari kar wrote:

                any ways can i customise the print dialog of the system

                Again, the answer does not change. I've already given you the list of skills required to replace the dialog AND/OR alter the existing one. This is an extremely advanced topic, not for beginners.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007, 2008

                M 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  manjari kar wrote:

                  i want to replace comdlg32.dll

                  You can't do that. The next time anyone installs a piece of software or MS releases a patch, it'll overwrite or replace what you put in.

                  manjari kar wrote:

                  any ways can i customise the print dialog of the system

                  Again, the answer does not change. I've already given you the list of skills required to replace the dialog AND/OR alter the existing one. This is an extremely advanced topic, not for beginners.

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007, 2008

                  M Offline
                  M Offline
                  manjari kar
                  wrote on last edited by
                  #13

                  see,in comdlg32.dll-1538-1033-print dialog pop up is comming.i inserted there controls for username and password in no of copies panel.i installed the resource hacker which used to customise the dialogs of comdlg32.dll.then i used one software for disable the windows file protection ,used inuse for replacing the customise comdlg32.dll and used move on boot for reboot.but it didnt replce the dll.tell me the process how to customise the windows xp print dialog.plz help me in any ways.This requirement is mandatory for me.help me. :((

                  How i will design a a form in windows service to print a document.

                  D 1 Reply Last reply
                  0
                  • M manjari kar

                    see,in comdlg32.dll-1538-1033-print dialog pop up is comming.i inserted there controls for username and password in no of copies panel.i installed the resource hacker which used to customise the dialogs of comdlg32.dll.then i used one software for disable the windows file protection ,used inuse for replacing the customise comdlg32.dll and used move on boot for reboot.but it didnt replce the dll.tell me the process how to customise the windows xp print dialog.plz help me in any ways.This requirement is mandatory for me.help me. :((

                    How i will design a a form in windows service to print a document.

                    D Offline
                    D Offline
                    Dave Kreskowiak
                    wrote on last edited by
                    #14

                    manjari kar wrote:

                    see,in comdlg32.dll-1538-1033-print dialog pop up is comming.i inserted there controls for username and password in no of copies panel.i installed the resource hacker which used to customise the dialogs of comdlg32.dll.then i used one software for disable the windows file protection ,used inuse for replacing the customise comdlg32.dll and used move on boot for reboot.but it didnt replce the dll

                    You are entirely on your own with this one. Putting in a username and password is just making things more complicated than they need to be. There is no legit reason to do this and it's easily defeatable. You are doing things that noone does. This is what makes it entirely on your shoulders now...

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                         2006, 2007, 2008

                    M 1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      manjari kar wrote:

                      see,in comdlg32.dll-1538-1033-print dialog pop up is comming.i inserted there controls for username and password in no of copies panel.i installed the resource hacker which used to customise the dialogs of comdlg32.dll.then i used one software for disable the windows file protection ,used inuse for replacing the customise comdlg32.dll and used move on boot for reboot.but it didnt replce the dll

                      You are entirely on your own with this one. Putting in a username and password is just making things more complicated than they need to be. There is no legit reason to do this and it's easily defeatable. You are doing things that noone does. This is what makes it entirely on your shoulders now...

                      A guide to posting questions on CodeProject[^]
                      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                           2006, 2007, 2008

                      M Offline
                      M Offline
                      manjari kar
                      wrote on last edited by
                      #15

                      ok,i understud ur point but what can i do.I already told my P.M that its not possible to do this.in one application only i can import the dlls and override it.but in xp how to modify.but he told priviously our people hv done this one using vb6.0.why u r unable this one in .net.so what should i will do.i m trying my best.thats why m askin. the last way i m thinking that whatever i modified inprint dialog i saved in c drive then i will put windows xp cd to restart setup and i want to use recovery console for repair using r. and there i will give the path of modified one.so is it possible way to do this or not plz suggest me. thanks, regards, manjari.

                      How i will design a a form in windows service to print a document.

                      D 1 Reply Last reply
                      0
                      • M manjari kar

                        ok,i understud ur point but what can i do.I already told my P.M that its not possible to do this.in one application only i can import the dlls and override it.but in xp how to modify.but he told priviously our people hv done this one using vb6.0.why u r unable this one in .net.so what should i will do.i m trying my best.thats why m askin. the last way i m thinking that whatever i modified inprint dialog i saved in c drive then i will put windows xp cd to restart setup and i want to use recovery console for repair using r. and there i will give the path of modified one.so is it possible way to do this or not plz suggest me. thanks, regards, manjari.

                        How i will design a a form in windows service to print a document.

                        D Offline
                        D Offline
                        Dave Kreskowiak
                        wrote on last edited by
                        #16

                        manjari kar wrote:

                        but he told priviously our people hv done this one using vb6.0.

                        Then he's going to have to prove it. Doing it in VB6 alone isn't possible. Personally, I think he's blowing smoke out his ass.

                        A guide to posting questions on CodeProject[^]
                        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                             2006, 2007, 2008

                        M 1 Reply Last reply
                        0
                        • D Dave Kreskowiak

                          manjari kar wrote:

                          but he told priviously our people hv done this one using vb6.0.

                          Then he's going to have to prove it. Doing it in VB6 alone isn't possible. Personally, I think he's blowing smoke out his ass.

                          A guide to posting questions on CodeProject[^]
                          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                               2006, 2007, 2008

                          M Offline
                          M Offline
                          manjari kar
                          wrote on last edited by
                          #17

                          thanks for support.i m totally fedup in this project.i want to leave this company.nw m searching outside.again thanks for support.take care.bye.

                          How i will design a a form in windows service to print a document.

                          M 1 Reply Last reply
                          0
                          • M manjari kar

                            thanks for support.i m totally fedup in this project.i want to leave this company.nw m searching outside.again thanks for support.take care.bye.

                            How i will design a a form in windows service to print a document.

                            M Offline
                            M Offline
                            manjari kar
                            wrote on last edited by
                            #18

                            personally something i m telling u that i think humanity is there in this world.in this company my p.m has assigned this project single me and he told you should takecare of entire project and he didnt give me any support or any idea of this.totally i m doing identity on this. 2 to 3 times i told it is not possible to modify in windows xp.but again n again he told u r totally unable to do this .what u know about .net.next month i will think about u.so nw m thinking before thinking about me ,i will think about this company.nw i hv one offer in another company.m thinking to leave this one.and one more thing ur suggetions really impressed me and i think u r the only one supporter for me in this matter. this is my mail id-manjari10i@gmail.com.if u want mail me.keep touch with me. thanks, regards, manjari

                            How i will design a a form in windows service to print a document.

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups