What is the path of "my computer" folder on windows?

Viewed 21293

I am working on a C++ windowsform project, using visual Studio IDE.
I use CFileDialog class to ask the user to select a file to open. It display an usual open file selection windows. I would like the default folder displayed to be the same as the one accessed when clicked on "My computer", where the harddrives, USB drives, dvd drives etc. are displayed.

I can define default folder by writting its path tolpstrInitialDir member, but I don't find the path for such a folder. I tried "\", "explorer.exe", "", none of them gave me the expected result. The application will be used by several users, so the solution must not include the user name in the path. i.e "C:\Documents and Settings[user]\Desktop\My Computer" may work but is not correct for my application.

Does anyone know of to define the "root" path of windows (i.e the root of C:\) ?

I searched on SO and internet but maybe I have used wrong keywords because I couldn't find appropriate content.

3 Answers

In the explorer, in the search bar copy the address of

This PC

and then select the text

This PC

and paste. Normally we get the

Ce PC ":: {CLSID}"

and then just copy

:: {CLSID}

and paste it wherever we want.

Related