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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. FindFirstPrinterChangeNotification() fail!

FindFirstPrinterChangeNotification() fail!

Scheduled Pinned Locked Moved C / C++ / MFC
helpsysadmintutorialquestion
4 Posts 2 Posters 0 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.
  • S Offline
    S Offline
    szcococut
    wrote on last edited by
    #1

    Iuse Administrator to Logged on My widnow xp. I enum the share printer connected in the network. I use openprinters() to open the printer ,it success. I get the printer handle. then I use FindFirstPrinterChangeNotification() to Monitor the printer ,it fail ,the Error code is 5(ERROR_ACCESS_DENIED). but if Use the domain user to logged on my window xp(just like: domain1\\user1), all is good . why? what different between of administrator(local) and domain1\\user1(domain)? how to fix it? thanks! my code like this: hPrinterNotification = FindFirstPrinterChangeNotification( ThreadParam.hPrinter, PRINTER_CHANGE_DELETE_JOB, 0, &NotificationOptions); if (hPrinterNotification == INVALID_HANDLE_VALUE) { CString strE; strE.Format ("FindFirstPrinterChangeNotification failed! Error code = %d",GetLastError()); return 0; } -- modified at 21:47 Monday 27th February, 2006

    B 1 Reply Last reply
    0
    • S szcococut

      Iuse Administrator to Logged on My widnow xp. I enum the share printer connected in the network. I use openprinters() to open the printer ,it success. I get the printer handle. then I use FindFirstPrinterChangeNotification() to Monitor the printer ,it fail ,the Error code is 5(ERROR_ACCESS_DENIED). but if Use the domain user to logged on my window xp(just like: domain1\\user1), all is good . why? what different between of administrator(local) and domain1\\user1(domain)? how to fix it? thanks! my code like this: hPrinterNotification = FindFirstPrinterChangeNotification( ThreadParam.hPrinter, PRINTER_CHANGE_DELETE_JOB, 0, &NotificationOptions); if (hPrinterNotification == INVALID_HANDLE_VALUE) { CString strE; strE.Format ("FindFirstPrinterChangeNotification failed! Error code = %d",GetLastError()); return 0; } -- modified at 21:47 Monday 27th February, 2006

      B Offline
      B Offline
      Blake Miller
      wrote on last edited by
      #2

      Your local administrator account does not necessarily have privileges on the network. It is possible to enumerate network resources without having necessary permission to access or utilize those resources. So, you can enumerate the printers, but when you try to open one, you fail from the local administrator account. Your domain account obviously has network printer privileges. People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks

      S 1 Reply Last reply
      0
      • B Blake Miller

        Your local administrator account does not necessarily have privileges on the network. It is possible to enumerate network resources without having necessary permission to access or utilize those resources. So, you can enumerate the printers, but when you try to open one, you fail from the local administrator account. Your domain account obviously has network printer privileges. People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks

        S Offline
        S Offline
        szcococut
        wrote on last edited by
        #3

        Blake Miller: can you tell how to open one from the local administrator account? thanks! cococut

        B 1 Reply Last reply
        0
        • S szcococut

          Blake Miller: can you tell how to open one from the local administrator account? thanks! cococut

          B Offline
          B Offline
          Blake Miller
          wrote on last edited by
          #4

          The same way you open the other ones, but you have to be granted access permission form the owner of the object, in this case the printer. In other words, a network administrator needs to grant the MachineName\Administrator account privileges to modify the printer. Also, you could try different access permission request, instead of ALL_ACCESS try something like 'read' access rights on the OpenPrinter command, that might work, since you are perhaps not trying to change anything. Most people seem to go for ALL_ACCESS when they only want to query a device. Opening for read only access often works where 'all access' or 'write access' requests fail. You could post the code for your OpenPrinter command and me or someone here could try to help you out. People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks

          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