Documents and Settings\Administrator\Application Data\Microsoft\Templates\
这个目录一般都是固定的,主要是得到系统盘,GetWindowsDirectory(),这个函数得到系统目录,它所对应的盘就是系统盘。
这个目录一般都是固定的,主要是得到系统盘,GetWindowsDirectory(),这个函数得到系统目录,它所对应的盘就是系统盘。
解决方案 »
- DELPHI中Tedit1 button1 FileListBox1,如何实现Tedit输入文字单击button,filelistbox显示类似文字列表
- 小弟想作一个万能查询!谁来帮小弟
- Suipack窗体大小控制问题
- 50分求 怎样让窗体接收文字??
- 关于ClientDataSet.Delta的问题
- "字符串数据,右截断(null)"到底是什么错误?
- 请问哪儿有农历控件?
- 请问TCustomIpClient和TCustomTcpServer有什么不同啊?
- 关于Internet Explorer_TridentDlgFrame类,请高手来看看
- 谁有做电脑公司进贷存的源码或一些思路吗?
- 关于Form的问题???
- 怎么样随机调用TStringList中的一个字符?
老东西。拿出来也许有用
uses shlobj, activex, comobj;{***************************************************************
*
* 名 称 : GetSpecialFolder
* 编 写: BlackFox
* 说 明 : 取得指定的文件夹
* 入 口 : nFolder,文件夹索引,参看shlobj
* 出 口 : 返回文件夹路径(无斜杠)
* 历 史 :
* 创建日期 :2001-05-30
****************************************************************}function GetSpecialFolder(nFolder: Integer): string;
var
pIDL: pItemIDList;
Buffer: array[0..MAX_PATH] of char;
Malloc: IMalloc;
begin
try try
OLECheck(SHGetMalloc(Malloc));
OLECheck(SHGetSpecialFolderLocation(0, nFolder, pIDL));
if ShGetPathFromIdList(pIDL, PChar(@Buffer)) then Result := Buffer
else
Result := ''; except
Result := ''; end;
finally
if pIDL <> nil then
Malloc.Free(pIDL);
end;end;procedure TForm1.FormCreate(Sender: TObject);
begin
ShowMessage(GetSpecialFolder(CSIDL_APPDATA) + '\Microsoft\Templates\');
end;
就是
'C:\Documents and Settings\Administrator\Application Data\Microsoft\Templates\'
var
s1,s2:array[1..40] of char;
begin
GetWindowsDirectory(@s1,40);
GetSystemDirectory(@s2,40);
ShowMessage('Windows目录: '+s1);
ShowMessage('System目录 :'+s2);
end;