`

Windows API SHGetSpecialFolderPath的用法 ,获取特殊文件夹

 
阅读更多

BOOL SHGetSpecialFolderPath (

HWND hwndOwner,

LPTSTR lpszPath,

int nFolder,

BOOL fCreate

);

示例:

获得自启动文件夹的路径

TCHAR filePath[MAX_PATH];

::SHGetSpecialFolderPath (NULL, filePath, CSIDL_STARTUP, FALSE);

CSIDL_STARTMENU —— /Windows/“开始”菜单

CSIDL_STARTUP —— /Windows/StartUp

CSIDL_WINDOWS —— /Windows

CSIDL_RECENT ——

CSIDL_PROGRAMS —— /Windows/“开始”菜单/程序

CSIDL_PROGRAM_FILES —— /Program Files

CSIDL_PERSONAL —— /My Documents

CSIDL_MYVIDEO ——

CSIDL_MYPICTURES —— /My Documents/我的图片

CSIDL_MYMUSIC —— /My Documents/我的音乐

CSIDL_FONTS —— /Windows/Fonts

CSIDL_FAVORITES —— /Windows/Favorites

CSIDL_DESKTOPDIRECTORY ——

CSIDL_DESKTOP —— /My Documents

CSIDL_APPDATA —— /Application Data

hwndOwner :用GetDesktopWindow API取一个窗口句柄。

lpszPath:返回的路径

nFolder:标识代号

fCreate:true :如果文件夹不存在则创建,false:不创建

lpszPath和nFolder对应关系:

nFolder lpszPath
0 C:/Documents and Settings/当前用户/桌面
2 C:/Documents and Settings/当前用户/「开始」菜单/程序
5 C:/Documents and Settings/当前用户/My Documents
6 C:/Documents and Settings/当前用户/Favorites
7 C:/Documents and Settings/当前用户/「开始」菜单/程序/启动
8 C:/Documents and Settings/当前用户/Recent
9 C:/Documents and Settings/当前用户/SendTo
11 C:/Documents and Settings/当前用户/「开始」菜单
13 C:/Documents and Settings/当前用户/My Documents/My Music
14 C:/Documents and Settings/当前用户/My Documents/My Videos
16 C:/Documents and Settings/当前用户/桌面
19 C:/Documents and Settings/当前用户/NetHood
20 C:/WINDOWS/Fonts
21 C:/Documents and Settings/当前用户/Templates
22 C:/Documents and Settings/All Users/「开始」菜单
23 C:/Documents and Settings/All Users/「开始」菜单/程序
24 C:/Documents and Settings/All Users/「开始」菜单/程序/启动
25 C:/Documents and Settings/All Users/桌面
26 C:/Documents and Settings/当前用户/Application Data
27 C:/Documents and Settings/当前用户/PrintHood
28 C:/Documents and Settings/当前用户/Local Settings/Application Data
31 C:/Documents and Settings/All Users/Favorites
32 C:/Documents and Settings/当前用户/Local Settings/Temporary Internet Files
33 C:/Documents and Settings/当前用户/Cookies
34 C:/Documents and Settings/当前用户/Local Settings/History
35 C:/Documents and Settings/All Users/Application Data
36 C:/WINDOWS
37 C:/WINDOWS/system32
38 C:/Program Files

39 C:/Documents and Settings/当前用户/My Documents/My Pictures
40 C:/Documents and Settings/当前用户
43 C:/Program Files/Common Files
45 C:/Documents and Settings/All Users/Templates
46 C:/Documents and Settings/All Users/Documents
47 C:/Documents and Settings/All Users/「开始」菜单/程序/管理工具
48 C:/Documents and Settings/当前用户/「开始」菜单/程序/管理工具
53 C:/Documents and Settings/All Users/Documents/My Music
54 C:/Documents and Settings/All Users/Documents/My Pictures
55 C:/Documents and Settings/All Users/Documents/My Videos
56 C:/WINDOWS/resources
59 C:/Documents and Settings/当前用户/Local Settings/Application Data/Microsoft/CD Burning
分享到:
评论

相关推荐

    获取系统特殊路径SHGetSpecialFolderPath函数.docx

    获取系统特殊路径SHGetSpecialFolderPath函数.docx

    易语言API取特定所有目录

    易语言API取特定所有目录源码,API取特定所有目录,SHGetSpecialFolderPath

    API_VB实例150(精)

    共150个API实例,全为VB源文件,打开VB工程源文件,可看到实例,运行即见效果! SendMessage改变任意程序的标题 SendMessage实现获得密码 IsIconic判断窗口是否已最小化 ...

    易语言几个IE对话框API应用例程

    几个IE对话框API应用例程,LaunchInternetControlPanel,LaunchConnectionDialog,LaunchSecurityDialog,LaunchSiteCertDialog,OpenFontsDialog,DoOrganizeFavDlg,SHGetSpecialFolderPath

    VC获取操作系统特殊路径的方法

    BOOL SHGetSpecialFolderPath ( HWND hwndOwner, LPTSTR lpszPath, int nFolder, BOOL fCreate);  hwndOwner :用GetDesktopWindow API取一个窗口句柄。  lpszPath:返回的路径  nFolder:标识代号  ...

    易语言NOD32升级ID获取器

    NOD32升级ID获取器,创建互斥体,创建线程,取文本_,读http源码,获取id,取升级数据,打开Internet_,关闭Internet句柄_,读Internet文件_,打开Internet地址_,CreateThread,SHGetSpecialFolderPath,MultiByteToWideChar_,...

    易语言枚举收藏夹

    易语言枚举收藏夹源码系统结构:枚举收藏夹,枚举目录,枚举文件,目录_取收藏夹目录,SHGetSpecialFolderPath, ======窗口_启动窗口 || ||------__启动窗口_创建完毕 || ||------枚举收藏夹 || ||------枚举

    易语言XP系统清理

    易语言XP系统清理源码,XP系统清理,清除系统临时文件,清除Internet临时文件,取操作系统,SHGetSpecialFolderPath

Global site tag (gtag.js) - Google Analytics