• 常用Shell的路径


    #define REG_SHELL "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
    #define REG_SHELL "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"

    里面很多很多值,仔细观察

    [HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders]
    [HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerUser Shell Folders]
    [HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders]
    [HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionExplorerUser Shell Folders]
    [HKEY_LOCAL_MACHINESoftwareWow6432NodeMicrosoftWindowsCurrentVersionexplorerShell Folders]
    [HKEY_LOCAL_MACHINESoftwareWow6432NodeMicrosoftWindowsCurrentVersionexplorerUser Shell Folders]

    GetDefaultUserProfileDirectory
    GetUserProfileDirectory
    例子:
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms682431(v=vs.85).aspx

    Roaming User Profiles
    https://msdn.microsoft.com/en-us/library/windows/desktop/bb776897(v=vs.85).aspx

    另外还有:

    SHGetFolderPath 取CSIDL_APPDATA路径,就是
    https://msdn.microsoft.com/en-us/library/windows/desktop/bb762181(v=vs.85).aspx

    USERPROFILE := GetEnvironmentVariable('USERPROFILE');
    
    function TDM.CreateBeyskyDirectories:
      string;
    
    begin
      Result := FalseStr;
      try
        if not DirectoryExists(USERPROFILE + 'AppDataRoamingmypath', False) then
          if not forcedirectories(USERPROFILE + 'AppDataRoamingmypath') then Exit;
        Result := TrueStr;
      except
        on E: Exception do Result := E.Message;
      end;
    end;

    或者

        你可以通过读取注册表来实现这一功能。我这之前写的一个项目里面用到了,代码如下:
    function TLoginWindow.ReadReg: string; // 读取reg,获得文件夹路径
    var
      myreg: TRegistry;
    const
      RegDir: string = 'SoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders';
    begin
      myreg := TRegistry.Create;
      myreg.RootKey := HKEY_CURRENT_USER;
      myreg.OpenKey(RegDir, False);
      Result := myreg.ReadString('AppData');
      myreg.Free;
    end;

    http://bbs.2ccc.com/topic.asp?topicid=517558

  • 相关阅读:
    oracle 语句 笔记
    10:基于Tomcat部署Web工程
    8.为什么IntelliJ IDEA首次加载比较慢
    04 全局配置,java 编意默认版本,1.6.修改配置
    02 IDEA创创建第一个maven工程
    01 安装IDEA
    spring security权限架架mvn坐标
    RBAC基于角色的权限访问控制
    MyBatis 中的#和$的区别
    python数据相关性分析 (计算相关系数)
  • 原文地址:https://www.cnblogs.com/findumars/p/6002094.html
Copyright © 2020-2023  润新知