本站首页    管理页面    写新日志    退出


«August 2025»
12
3456789
10111213141516
17181920212223
24252627282930
31


公告
================

注会练习软件
http://www.cpasoft.com.cn
我的注会软件官网

http://blog.163.com/abc7105@126/

 

 


哈哈,热爱快“过气”的DELPHI


我的分类(专题)

日志更新

最新评论

留言板

链接

Blog信息
blog名称:注册会计师(注会)练习软件
日志总数:398
评论数量:116
留言数量:27
访问次数:3266419
建立时间:2005年6月6日




[delpih编程]取得程序中一些特殊文件夹的位置【转贴】
软件技术

吕向阳 发表于 2009/4/3 9:11:54

//取得程序中一些特殊文件夹的位置 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, StdCtrls,ShlObj; type TForm1 = class(TForm) Button1: TButton; ListView1: TListView; procedure Button1Click(Sender: TObject); private function GetSpecialFolderDir(const folderid: integer): string; procedure AddListItem(LCaption, LSubItem: string); procedure AddToListView; { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.AddListItem(LCaption, LSubItem: string); var I: TListItem; begin i := ListView1.Items.Add; i.Caption := LCaption; i.SubItems.Add(LSubItem); end; procedure TForm1.AddToListView; begin AddListItem('桌面', GetSpecialFolderDir(0)); AddListItem('所有用户桌面', GetSpecialFolderDir(25)); AddListItem('开始菜单程序', GetSpecialFolderDir(2)); AddListItem('所有用户开始菜单程序', GetSpecialFolderDir(23)); AddListItem('文档', GetSpecialFolderDir(5)); AddListItem('收藏夹', GetSpecialFolderDir(6)); AddListItem('所以用户收藏夹', GetSpecialFolderDir(31)); AddListItem('启动文件夹', GetSpecialFolderDir(7)); AddListItem('所有用户启动文件夹', GetSpecialFolderDir(24)); AddListItem('Recent文件夹', GetSpecialFolderDir(8)); AddListItem('发送到', GetSpecialFolderDir(9)); AddListItem('登陆用户开始菜单', GetSpecialFolderDir(11)); AddListItem('所有用户开始菜单', GetSpecialFolderDir(22)); AddListItem('网上邻居', GetSpecialFolderDir(19)); AddListItem('字体文件夹', GetSpecialFolderDir(20)); AddListItem('Template文件夹', GetSpecialFolderDir(21)); AddListItem('所有用户Template文件夹', GetSpecialFolderDir (45)); AddListItem('ApplicaionData 文件夹', GetSpecialFolderDir(26)); AddListItem('打印文件夹', GetSpecialFolderDir(27)); AddListItem('当前用户本地应用程序设置文件夹', GetSpecialFolderDir(28)); AddListItem('Internet临时文件夹', GetSpecialFolderDir(32)); AddListItem('Internet缓存文件夹', GetSpecialFolderDir(33)); AddListItem('当前用户历史文件夹', GetSpecialFolderDir(34)); AddListItem('所有用户应用程序设置文件夹', GetSpecialFolderDir (35)); AddListItem('Windows系统目录', GetSpecialFolderDir(36)); AddListItem('程序文件夹', GetSpecialFolderDir(38)); AddListItem('System32系统目录', GetSpecialFolderDir(37)); AddListItem('当前用户图片收藏夹', GetSpecialFolderDir(39)); AddListItem('当前用户文件夹', GetSpecialFolderDir(40)); AddListItem('公共文件夹', GetSpecialFolderDir(43)); AddListItem('管理工具', GetSpecialFolderDir(47)); AddListItem('登陆用户管理工具', GetSpecialFolderDir(48)); AddListItem('所有用户图片收藏夹', GetSpecialFolderDir(54)); AddListItem('所有用户视频收藏夹', GetSpecialFolderDir(55)); AddListItem('主题资源文件夹', GetSpecialFolderDir(56)); AddListItem('CD Burning', GetSpecialFolderDir(59)); end; function TForm1.GetSpecialFolderDir(const folderid: integer): string; var pidl: pItemIDList; buffer: array[0..255] of char; begin //取指定的文件夹项目表 SHGetSpecialFolderLocation(application.Handle, folderid, pidl); SHGetPathFromIDList(pidl, buffer); //转换成文件系统的路径 Result := strpas(buffer); end; procedure TForm1.Button1Click(Sender: TObject); begin AddToListView; end; end.


阅读全文(2197) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.230 second(s), page refreshed 144772365 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号