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. How to set the initial directory of the CFileDialog to be 'My Computer'?

How to set the initial directory of the CFileDialog to be 'My Computer'?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
5 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.
  • C Offline
    C Offline
    Cyrus Dang
    wrote on last edited by
    #1

    Hi, So far, I did it by setting the initial dir to be C:\ and then sending a virtual click to "Up One Level" button. Do we have any better ways to do that? I think it should have some special string so that CFileDialog could understand and start the dialog with "My Computer" as its initial directory. Unfortunately, I've not found it yet! Please help me. Thanks in advance.

    N 1 Reply Last reply
    0
    • C Cyrus Dang

      Hi, So far, I did it by setting the initial dir to be C:\ and then sending a virtual click to "Up One Level" button. Do we have any better ways to do that? I think it should have some special string so that CFileDialog could understand and start the dialog with "My Computer" as its initial directory. Unfortunately, I've not found it yet! Please help me. Thanks in advance.

      N Offline
      N Offline
      Nish Nishant
      wrote on last edited by
      #2

      Set the initial directory to ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}

      CFileDialog f(TRUE);
      f.m_ofn.lpstrInitialDir = L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}";
      f.DoModal();

      C 1 Reply Last reply
      0
      • N Nish Nishant

        Set the initial directory to ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}

        CFileDialog f(TRUE);
        f.m_ofn.lpstrInitialDir = L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}";
        f.DoModal();

        C Offline
        C Offline
        Cyrus Dang
        wrote on last edited by
        #3

        I truly appreciate your help. Another thing I wonder is that whether this is documented by Microsoft. I'm testing it on previous version of Windows (NT, 9x). Will it be changed in the future? Thanks so much.

        N D 2 Replies Last reply
        0
        • C Cyrus Dang

          I truly appreciate your help. Another thing I wonder is that whether this is documented by Microsoft. I'm testing it on previous version of Windows (NT, 9x). Will it be changed in the future? Thanks so much.

          N Offline
          N Offline
          Nish Nishant
          wrote on last edited by
          #4

          I am not sure of Vista, but it should work the same in 98, 2000, XP and 2003.

          1 Reply Last reply
          0
          • C Cyrus Dang

            I truly appreciate your help. Another thing I wonder is that whether this is documented by Microsoft. I'm testing it on previous version of Windows (NT, 9x). Will it be changed in the future? Thanks so much.

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            That CLSID has resolved to 'My Computer' since Windows 95. I see no reason for it to change in the future.


            "Take only what you need and leave the land as you found it." - Native American Proverb

            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