SHGetSpecialFolderLocation/SHGetSpecialFolderPath

  • Thread starter Thread starter Peter Larsen []
  • Start date Start date
P

Peter Larsen []

Hi,

I'm using VS 2005 and dotNet 2.0.

Is there an easier way to obtain MyDocuments (and related special folders)
than through the shell ??
The Shell way:
Win32Assist.SHGetSpecialFolderLocation(IntPtr.Zero,
Win32Assist.CSIDL.CSIDL_MYDOCUMENTS, ref pidl);

I guess there are some nice functions in dotNet, right ??

Thank you in advance.
BR
Peter
 
Hello, Peter!

PL> I'm using VS 2005 and dotNet 2.0.

PL> Is there an easier way to obtain MyDocuments (and related special
PL> folders) than through the shell ??
PL> The Shell way:
PL> Win32Assist.SHGetSpecialFolderLocation(IntPtr.Zero,
PL> Win32Assist.CSIDL.CSIDL_MYDOCUMENTS, ref pidl);

PL> I guess there are some nice functions in dotNet, right ??

Yep, there are :8-)
Look at Environment class, method GetFolderPath.

To get folders that you've retrieved above you can write
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
Back
Top