OpenFileDialog: MyComputer

  • Thread starter Thread starter Mike Wesling
  • Start date Start date
M

Mike Wesling

Hi,

does anyone know how to show the OpenFileDialog with "My Computer" as
InitialDirectory?

I tried it with

openFileDialog.InitialDirectory =
Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);

but it didn't work, unfortunately.
 
Mike,

MyComputer is not a phisical folder on the disk that's why
Environment.GetFolderPath returns an empty string. This btw is documented
behavior. Folders such MyComputer are called virtual folders and they have
pre-defined GUIDs that OpenFileDialog can open them.

Try this:
openFileDialog.InitialDirectory =
"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}";

Other special folder GUIDs are:

MyComputer - ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
MyDocuments - ::{450D8FBA-AD25-11D0-98A8-0800361B1103}
MyNetworkPlaces - ::{208D2C60-3AEA-1069-A2D7-08002B30309D}
Printers - ::{2227A280-3AEA-1069-A2DE-08002B30309D}
RecycleBin = ::{645FF040-5081-101B-9F08-00AA002F954E}
 
Stoitcho said:
MyComputer is not a phisical folder on the disk that's why
Environment.GetFolderPath returns an empty string. This btw is documented
behavior. Folders such MyComputer are called virtual folders and they have
pre-defined GUIDs that OpenFileDialog can open them.

Try this:
openFileDialog.InitialDirectory =
"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}";

Other special folder GUIDs are:

MyComputer - ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
MyDocuments - ::{450D8FBA-AD25-11D0-98A8-0800361B1103}
MyNetworkPlaces - ::{208D2C60-3AEA-1069-A2D7-08002B30309D}
Printers - ::{2227A280-3AEA-1069-A2DE-08002B30309D}
RecycleBin = ::{645FF040-5081-101B-9F08-00AA002F954E}

Thanks for your help!
 
Mike,

MyComputer is not a phisical folder on the disk that's why
Environment.GetFolderPath returns an empty string. This btw is documented
behavior. Folders such MyComputer are called virtual folders and they have
pre-defined GUIDs that OpenFileDialog can open them.

Try this:
openFileDialog.InitialDirectory =
"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}";

Other special folder GUIDs are:

MyComputer - ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
MyDocuments - ::{450D8FBA-AD25-11D0-98A8-0800361B1103}
MyNetworkPlaces - ::{208D2C60-3AEA-1069-A2D7-08002B30309D}
Printers - ::{2227A280-3AEA-1069-A2DE-08002B30309D}
RecycleBin = ::{645FF040-5081-101B-9F08-00AA002F954E}

Stoitcho,

This is a bit off topic, but perhaps you know the answer to this one also:

In XP it annoys me that the MyDocuments folder is at the top of the folder list
when I open the File Browser. Is there a way to make it appear at the bottom of
the list?

Thanks,
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top