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

Windows Directory

Scheduled Pinned Locked Moved C / C++ / MFC
5 Posts 5 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
    si_69
    wrote on last edited by
    #1

    Hi Can anyone tell me the best way to obtain the windows directory and drive thanks Simon

    L H G 3 Replies Last reply
    0
    • S si_69

      Hi Can anyone tell me the best way to obtain the windows directory and drive thanks Simon

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Look up SHGetFolderPath in the documentation and use the flag 'CSIDL_WINDOWS', this will get you the path to the windows folder (typically c:\windows). Always use SHGetFolderPath for special folders like My Documents, Program Files and so on. It's a bit of an ugly function so I'd wrap it in something a bit cleaner that returns a string.

      Dave Kerr codechamber@hotmail.com http://www.codechamber.com

      M 1 Reply Last reply
      0
      • S si_69

        Hi Can anyone tell me the best way to obtain the windows directory and drive thanks Simon

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        See GetWindowsDirectory

        _**


        **_

        WhiteSky


        1 Reply Last reply
        0
        • L Lost User

          Look up SHGetFolderPath in the documentation and use the flag 'CSIDL_WINDOWS', this will get you the path to the windows folder (typically c:\windows). Always use SHGetFolderPath for special folders like My Documents, Program Files and so on. It's a bit of an ugly function so I'd wrap it in something a bit cleaner that returns a string.

          Dave Kerr codechamber@hotmail.com http://www.codechamber.com

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          CSIDL_WINDOWS was only recently added to the CSIDL_* list. Use GetWindowsDirectory() to have your code work on all versions of the OS

          --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

          1 Reply Last reply
          0
          • S si_69

            Hi Can anyone tell me the best way to obtain the windows directory and drive thanks Simon

            G Offline
            G Offline
            G_S
            wrote on last edited by
            #5

            UINT GetWindowsDirectory( LPTSTR lpBuffer, // buffer for Windows directory UINT uSize // size of directory buffer );

            G_S

            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