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. path of my documents folder

path of my documents folder

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 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.
  • R Offline
    R Offline
    r i s h a b h s
    wrote on last edited by
    #1

    dear all, how can i retrieve the path of My Documents folder for specific users (say guest) ? is there any function which returns the path. my documents folder has different location in windows 9x and Xp........any way out? rIsHaBh

    I 1 Reply Last reply
    0
    • R r i s h a b h s

      dear all, how can i retrieve the path of My Documents folder for specific users (say guest) ? is there any function which returns the path. my documents folder has different location in windows 9x and Xp........any way out? rIsHaBh

      I Offline
      I Offline
      iceage
      wrote on last edited by
      #2

      // Allocate a pointer to an Item ID list LPITEMIDLIST pidl; // Get a pointer to an item ID list that // represents the path of a special folder HRESULT hr = SHGetSpecialFolderLocation(NULL, /*CSIDL_SEARCH_MSDN*/, &pidl); // Convert the item ID list's binary // representation into a file system path char szPath[_MAX_PATH]; SHGetPathFromIDList(pidl, szPath); // Allocate a pointer to an IMalloc interface LPMALLOC pMalloc; // Get the address of our task allocator's IMalloc interface hr = SHGetMalloc(&pMalloc); // Free the item ID list allocated by SHGetSpecialFolderLocation pMalloc->Free(pidl); // Free our task allocator pMalloc->Release(); // Work with the special folder's path (contained in szPath) strcat(szPath , "\\Folder");

      N 1 Reply Last reply
      0
      • I iceage

        // Allocate a pointer to an Item ID list LPITEMIDLIST pidl; // Get a pointer to an item ID list that // represents the path of a special folder HRESULT hr = SHGetSpecialFolderLocation(NULL, /*CSIDL_SEARCH_MSDN*/, &pidl); // Convert the item ID list's binary // representation into a file system path char szPath[_MAX_PATH]; SHGetPathFromIDList(pidl, szPath); // Allocate a pointer to an IMalloc interface LPMALLOC pMalloc; // Get the address of our task allocator's IMalloc interface hr = SHGetMalloc(&pMalloc); // Free the item ID list allocated by SHGetSpecialFolderLocation pMalloc->Free(pidl); // Free our task allocator pMalloc->Release(); // Work with the special folder's path (contained in szPath) strcat(szPath , "\\Folder");

        N Offline
        N Offline
        Neville Franks
        wrote on last edited by
        #3

        Or even simpler: if ( SHGetSpecialFolderPath( NULL, pszMyDocFolder, CSIDL_PERSONAL, FALSE ) ) return pszMyDocFolder;or: if( SUCCEEDED( SHGetFolderPath( NULL, CSIDL_PERSONAL, // same as CSIDL_MYDOCUMENTS. SHGetFolderPath() & CSIDL_MYDOCUMENTS needs latest SDK NULL, 0, pszMyDocFolder ) ) ) { return pszMyDocFolder; }depending on which version of the SDK you have installed. Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com

        R 1 Reply Last reply
        0
        • N Neville Franks

          Or even simpler: if ( SHGetSpecialFolderPath( NULL, pszMyDocFolder, CSIDL_PERSONAL, FALSE ) ) return pszMyDocFolder;or: if( SUCCEEDED( SHGetFolderPath( NULL, CSIDL_PERSONAL, // same as CSIDL_MYDOCUMENTS. SHGetFolderPath() & CSIDL_MYDOCUMENTS needs latest SDK NULL, 0, pszMyDocFolder ) ) ) { return pszMyDocFolder; }depending on which version of the SDK you have installed. Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com

          R Offline
          R Offline
          r i s h a b h s
          wrote on last edited by
          #4

          thnx a ton guyz! rIsHaBh

          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