LendKey

Wednesday, November 28, 2007

Get default folders in Windows

In order to get any system folder under Windows (I guess from 95 to Vista) by any programming language, you can call function:

HRESULT SHGetFolderPath( HWND hwndOwner,
int nFolder,
HANDLE hToken,
DWORD dwFlags,
LPTSTR pszPath
);
( http://msdn2.microsoft.com/en-us/library/ms647764.aspx )

and pass in the folder you are looking for, such as:
CSIDL_MYDOCUMENTS: My Document
CSIDL_COMMON_APPDATA: C:\Documents and Settings\All Users\Application Data
CSIDL_PROGRAM_FILES: C:\Program Files.

Check the following link for all IDs:
http://msdn2.microsoft.com/en-us/library/bb762494.aspx

Hope these two links can be handy to you.

No comments: