得到windows系统文件夹

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Function GetApplicationExeName: string;
begin
Result := ParamStr(0);
end;

Function GetApplicationShortExeName: string;
begin
Result :=ExtractFileName(ParamStr(0));
end;

Function GetWindowsDir: string; //c:\winnt
var
vBuffer: array [0..MAX_PATH] of Char;
begin
GetWindowsDirectory(vBuffer,MAX_PATH);
Result :=vBuffer;
end;

Function GetSystemDir: string; //c:\winnt\system32
var
vBuffer: array [0..MAX_PATH] of Char;
begin
GetSysTemDirectory(vBuffer,MAX_PATH);
Result :=vBuffer;
end;

Function GetTempDir: string; //应用程序的路径 如D:/winnt/temp
var
vBuffer: array [0..MAX_PATH] of Char;
begin
GetTempPath(MAX_PATH,vBuffer);
Result :=vBuffer;
end;

Function GetApplicationPath:String; //应用程序的路径 如D:/feng/
begin
Result:=ExtractFilePath(GetApplicationExeName);
end;

Function GetApplicationDir:String; //应用程序的路径 如D:/feng
begin
Result:=ExtractFileDir(GetApplicationExeName);
end;

Function GetCurrentDir: string; //应用程序的路径 如D:/feng
var
vBuffer: array [0..MAX_PATH] of Char;
begin
GetCurrentDirectory(MAX_PATH,vBuffer);
Result :=vBuffer;
end;

//程序组目录
function GetProgramsDir: string;
begin
Result:=GetSystemFolderDir(CSIDL_PROGRAMS);
end;

//我的文档 //如C:\My Documents
function GetMy_DocumentsDir: string;
begin
Result:=GetSystemFolderDir(CSIDL_PERSONAL);
end;

function GetFavoritesDir: string;
begin
Result:=GetSystemFolderDir(CSIDL_FAVORITES);
end;

function GetSystemFolderDir(mFolder: Integer): string;
{ 返回获取系统文件或系统目录}
{ CSIDL_DESKTOP = $0000; 桌面
CSIDL_INTERNET = $0001;
CSIDL_PROGRAMS = $0002; 程序组 D:\Documents and Settings\Administrator\「开始」菜单\程序
CSIDL_CONTROLS = $0003; 控制面板
CSIDL_PRINTERS = $0004; 打印机
CSIDL_PERSONAL = $0005; 我的文档
CSIDL_FAVORITES = $0006; 收藏夹
CSIDL_STARTUP = $0007; 启动
CSIDL_RECENT = $0008; 最近文档
CSIDL_SENDTO = $0009; 发送到
CSIDL_BITBUCKET = $000a; 回收站
CSIDL_STARTMENU = $000b; 开始菜单
CSIDL_DESKTOPDIRECTORY = $0010; 桌面目录
CSIDL_DRIVES = $0011; 我的电脑
CSIDL_NETWORK = $0012; 网上邻居
CSIDL_NETHOOD = $0013; 网上邻居目录
CSIDL_FONTS = $0014; 字体
CSIDL_TEMPLATES = $0015; //模版
CSIDL_COMMON_STARTMENU = $0016; //公用的开始菜单
CSIDL_COMMON_PROGRAMS = $0017;
CSIDL_COMMON_STARTUP = $0018;
CSIDL_COMMON_DESKTOPDIRECTORY = $0019;
CSIDL_APPDATA = $001a; //D:\Documents and Settings\Administrator\Application Data
CSIDL_PRINTHOOD = $001b; //D:\Documents and Settings\Administrator\PrintHood
CSIDL_ALTSTARTUP

= $001d; // DBCS
CSIDL_COMMON_ALTSTARTUP = $001e; // DBCS
CSIDL_COMMON_FAVORITES = $001f;
CSIDL_INTERNET_CACHE = $0020; D:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files
CSIDL_COOKIES = $0021; Cook文件夹
CSIDL_HISTORY = $0022; 历史文件夹
CSIDL_COMMON_APPDATA = $0023;
= $0024; D:\WINNT
= $0025; D:\WINNT\system32
= $0026 D:\Program Files
= $0027 D:\Documents and Settings\Administrator\My Documents\My Pictures
= $0028 D:\Documents and Settings\Administrator
= $0029 D:\WINNT\system32
}
var
vItemIDList: PItemIDList;
vBuffer: array[0..MAX_PATH] of Char;
begin
SHGetSpecialFolderLocation(0, mFolder, vItemIDList);
SHGetPathFromIDList(vItemIDList, vBuffer); //转换成文件系统的路径
Result := vBuffer;
end;


相关文档
最新文档