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. get default printer name

get default printer name

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
3 Posts 3 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.
  • V Offline
    V Offline
    vgkotha
    wrote on last edited by
    #1

    hi i like to get the default printer name on windowsNT/2000/xp systems. how can i acheive it actually i am using EnumPrinters() like below "EnumPrinters(PRINTER_ENUM_DEFAULT,NULL,5,(LPBYTE)pinfo5,dwBytesNeeded,&dwBytesNeeded,&dwReturned);" but the above function is working on win95/98 its not supporting please help how can i achieve. thank you from venu

    N C 2 Replies Last reply
    0
    • V vgkotha

      hi i like to get the default printer name on windowsNT/2000/xp systems. how can i acheive it actually i am using EnumPrinters() like below "EnumPrinters(PRINTER_ENUM_DEFAULT,NULL,5,(LPBYTE)pinfo5,dwBytesNeeded,&dwBytesNeeded,&dwReturned);" but the above function is working on win95/98 its not supporting please help how can i achieve. thank you from venu

      N Offline
      N Offline
      Navin
      wrote on last edited by
      #2

      I think in 95/98/Me, you have to monkey with the WIN.INI file to get the info you need. Try something like this: TCHAR buffer[MAX_PATH]; ::GetProfileString("Windows", "device", "", buffer, MAX_PATH); (Look up GetProfileString on MSDN for more info.) The printer info should be in that buffer, although I think it also contains some additional stuff (like the port name) so you may have to parse it a little. Hope this gets you on the right track. Even a broken clock is right twice a day.

      1 Reply Last reply
      0
      • V vgkotha

        hi i like to get the default printer name on windowsNT/2000/xp systems. how can i acheive it actually i am using EnumPrinters() like below "EnumPrinters(PRINTER_ENUM_DEFAULT,NULL,5,(LPBYTE)pinfo5,dwBytesNeeded,&dwBytesNeeded,&dwReturned);" but the above function is working on win95/98 its not supporting please help how can i achieve. thank you from venu

        C Offline
        C Offline
        Chad Koehler
        wrote on last edited by
        #3

        Look up the ::PrintDlg Win 32 API Function. There is a flag you can set to retrieve the default information. If you are using MFC, CPrintDlg offers the same functionality. You can get the information without displaying the dialog in either case.

        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