转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 软件开发 >> Delphi程序 >> 正文
获取 Windows 特殊文件夹函数         ★★★★

获取 Windows 特殊文件夹函数

作者:闵涛 文章来源:闵涛的学习笔记 点击数:826 更新时间:2009/4/23 18:26:58

在网上找不到比较全的,干脆自己做,现贡献出来。

unit Utils;

interface

uses
  Windows, SysUtils, ShlObj;

type
  TSpecialFolder = (
    sfDesktop,                // <desktop>
    sfInternet,               // Internet Explorer (icon on desktop)
    sfPrograms,               // Start Menu\Programs
    sfControls,               // My Computer\Control Panel
    sfPrinters,               // My Computer\Printers
    sfPersonal,               // My Documents
    sfFavorites,              // <user name>\Favorites
    sfStartup,                // Start Menu\Programs\Startup
    sfRecent,                 // <user name>\Recent
    sfSendTo,                 // <user name>\SendTo
    sfBitBucket,              // <desktop>\Recycle Bin
    sfStartMenu,              // <user name>\Start Menu
    sfMyDocuments,            // logical "My Documents" desktop icon
    sfMyMusic,                // "My Music" folder
    sfMyVideo,                // "My Videos" folder
    sfDesktopDirectory,       // <user name>\Desktop
    sfDrives,                 // My Computer
    sfNetwork,                // Network Neighborhood (My Network Places)
    sfNethood,                // <user name>\nethood
    sfFonts,                  // windows\fonts
    sfTemplates,              // <user name>\Templates
    sfCommonStartMenu,        // All Users\Start Menu
    sfCommonPrograms,         // All Users\Start Menu\Programs
    sfCommonStartup,          // All Users\Startup
    sfCommonDesktopDirectory, // All Users\Desktop
    sfAppData,                // <user name>\Application Data
    sfPrinthood,              // <user name>\PrintHood
    sfLocalAppData,           // <user name>\Local Settings\Applicaiton Data (non roaming)
    sfALTStartup,             // non localized startup
    sfCommonALTStartup,       // non localized common startup
    sfCommonFavorites,        // All Users\Favorites
    sfInternetCache,          // <user name>\Local Settings\Temporary Internet Files
    sfCookies,                // <user name>\Cookies
    sfHistory,                // <user name>\Local Settings\History
    sfCommonAppData,          // All Users\Application Data
    sfWindows,                // GetWindowsDirectory()
    sfSystem,                 // GetSystemDirectory()
    sfProgramFiles,           // C:\Program Files
    sfMyPictures,             // C:\Program Files\My Pictures
    sfProfile,                // USERPROFILE
    sfSystemX86,              // x86 system directory on RISC
    sfProgramFilesX86,        // x86 C:\Program Files on RISC
    sfProgramFilesCommon,     // C:\Program Files\Common
    sfProgramFilesCommonX86,  // x86 Program Files\Common on RISC
    sfCommonTemplates,        // All Users\Templates
    sfCommonDocuments,        // All Users\Documents
    sfCommonAdminTools,       // All Users\Start Menu\Programs\Administrative Tools
    sfAdminTools,             // <user name>\Start Menu\Programs\Administrative Tools
    sfConnections,            // Network and Dial-up Connections
    sfCommonMusic,            // All Users\My Music
    sfCommonPictures,         // All Users\My Pictures
    sfCommonVideo,            // All Users\My Video
    sfResources,              // Resource Direcotry
    sfResourcesLocalized,     // Localized Resource Direcotry
    sfCommonOEMLinks,         // Links to All Users OEM specific apps
    sfCDBurnArea,             // USERPROFILE\Local Settings\Application Data\Microsoft\CD Burning
    sfComputersNearMe         // Computers Near Me (computered from Workgroup membership)
  );

function GetSpecialFolder(SpecialFolder: TSpecialFolder): string;

implementation

function GetSpecialFolder(SpecialFolder: TSpecialFolder): string;

const
  SpecialFolderValues: array[TSpecialFolder] of Integer = ($0000, $0001, $0002,
    $0003, $0004, $0005, $0006, $0007, $0008, $0009, $000a, $000b, $000c, $000d,
    $000e, $0010, $0011, $0012, $0013, $0014, $0015, $0016, $0017, $0018, $0019,
    $001a, $001b, $001c, $001d, $001e, $001f, $0020, $0021, $0022, $0023, $0024,
    $0025, $0026, $0027, $0028, $0029, $002a, $002b, $002c, $002d, $002e, $002f,
    $0030, $0031, $0035, $0036, $0037, $0038, $0039, $003a, $003b, $003d);

var
  ItemIDList: PItemIDList;
  Buffer: array [0..MAX_PATH] of Char;
begin
  SHGetSpecialFolderLocation(0, SpecialFolderValues[SpecialFolder], ItemIDList);
  SHGetPathFromIDList(ItemIDList, Buffer);
  Result := StrPas(Buffer);
end;

end.


[系统软件]windows下Apache+php+mysql的安装与配置图解  [网页制作]Javascript获取各种浏览器可见窗口大小
[操作系统]在Windows中玩转Linux操作系统  [操作系统]死马还当活马医:6种方法挽救Windows系统
[办公软件]VBA获取U盘、主板、CPU序列号和网卡MAC地址  [Web开发]net.下如何获取网卡与主板系列号
[Web开发]用ASP.Net获取客户端网卡的MAC  [Web开发]超时时间已到,在从池中获取连接之前超时时间已出…
[Web开发]如何获取HTML页面中的图片地址并将图片下载保存到…  [网页制作]使用Javascript获取客户端网卡MAC地址和IP地址和计…
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · C语言系列  · VB.NET程序
    · JAVA开发  · Delphi程序
    · 脚本语言
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台