• SHGetSpecialFolderPath


    转自:百度百科 http://baike.baidu.com/view/3449405.htm


    SHGetSpecialFolderPath

    目录

    简介

    编辑本段简介

    该api用来获取指定的系统路径
    API声明: function ulongSHGetSpecialFolderPath(long hwndOwner,ref string lpszPath,int nFolder,boolean fCreate ) LIBRARY "shell32.dll" ALIAS FOR "SHGetSpecialFolderPathA"
    Function Long GetDesktopWindow() Library 'user32.dll'
    hwndOwner:可用GetDesktopWindow API取一个窗口句柄。或直接传null.
    lpszPath:返回路径的缓冲区
    nFolder:标识代号
    fCreate:true :如果文件夹不存在则创建,false:不创建
    lpszPath和nFolder对应关系:
    如:SHGetSpecialFolderPath(NULL,strProfilesPath,CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE,TRUE)
    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
    实例
    #include <shlobj.h>
    #pragma comment(lib, "shell32.lib")
    TCHAR szPath[MAX_PATH];
    SHGetSpecialFolderPath(NULL,szPath,CSIDL_COMMON_DOCUMENTS, FALSE);
    // szPath 就是对于这个函数MSDN:使用说明:这里面的CSIDL可能有些使用不正常,最好参考本地SHLOBJ.H文件里面的定义使用保证能using,:)
    TCHAR szPath[MAX_PATH];
    SHGetSpecialFolderPath(NULL,szPath,CSIDL_APPDATA,FALSE);
    MessageBox(NULL,szPath,"当前用户配置路径",MB_ICONSTOP);

  • 相关阅读:
    python之面向对象之类变量和实例变量
    python之面向对象之封装
    python之shutil模块
    利用python实现冒泡排序
    利用python实现二分法和斐波那契序列
    thinkphp input
    从右向左
    全局修改composer源地址
    Git忽略规则及.gitignore规则不生效的解决办法
    mysql主从数据库不同步的2种解决方法 (转载)
  • 原文地址:https://www.cnblogs.com/pamxy/p/2991519.html
Copyright © 2020-2023  润新知