SHGetSpecialFolderPath 函数用来获取指定系统路径
0x01.原型和参数
BOOL SHGetSpecialFolderPath(
HWND hwndOwner,
_Out_ LPTSTR lpszPath,
_In_ int csidl,
_In_ BOOL fCreate
);
功能:用来获取指定的系统路径
Parameters
HWND hwndOwner, //窗口所有者的句柄。可用GetDesktopWindow API取一个窗口句柄或直接传null.
LPTSTR lpszPath, //返回路径的缓冲区,该缓冲区的大小至少为MAX_PATH
int nFolder, //系统路径的CSIDL标识
BOOL fCreate, //指示文件夹不存在时是否创建。为false则不创建,否则创建
Return value
0x02.参数解析
CSIDL:
CSIDL (constant special item ID list)是系统定义的特殊条目的ID列表,在vista之后被KNOWNFOLDERID所替代(但为保持兼容性,仍支持CSIDL)。在shlobj.h中进行定义,在xp的SDK中定义如下:
#define CSIDL_DESKTOP 0x0000 // <desktop>
#define CSIDL_INTERNET 0x0001 // Internet Explorer (icon on desktop)
#define CSIDL_PROGRAMS 0x0002 // Start Menu\Programs
#define CSIDL_CONTROLS 0x0003 // My Computer\Control Panel
#d