代码
uses
  Shlobj;

const
  CSIDL_COMMON_APPDATA                
= $0023// DELPHI7中Shlobj单元未定义,DELPHI2007包含了定义
                                                      
// 不知传递路径的参数值,可以查询 http://baike.baidu.com/view/3143145.htm

var
  Str: 
string;
  MChar: array[
0..250] of char;
begin
  SHGetSpecialFolderPath(
0, MChar, CSIDL_COMMON_APPDATA, False);
  ShowMessage(MChar);
end;
 
获取当前用户路径
function GetCurrentUsrDeskPath: string;
begin
  SetLength(Result, MAX_PATH);
  ExpandEnvironmentStrings(PAnsiChar('%UserProfile%'), PAnsiChar(Result), MAX_PATH);
end;

 

相关文章:

  • 2021-12-09
  • 2021-09-23
  • 2021-11-29
  • 2021-12-09
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2021-09-20
猜你喜欢
  • 2021-12-06
  • 2022-12-23
  • 2021-08-18
  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案