Chinaunix首页 | 论坛 | 博客
  • 博客访问: 36410
  • 博文数量: 19
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 230
  • 用 户 组: 普通用户
  • 注册时间: 2013-10-13 00:47
文章分类

全部博文(19)

文章存档

2014年(6)

2013年(13)

我的朋友

分类:

2014-11-20 09:32:27

引用单元
  uses ShlObj
 
获取方法:
function GetPath(FID: Integer): string;
var
  pidl: PItemIDList;
  path: array[0..MAX_PATH] of Char;
begin
  SHGetSpecialFolderLocation(0, FID, pidl);
  SHGetPathFromIDList(pidl, path);
  Result := path;
end;
 
参数可以为下面这些:
 
1    CSIDL_DESKTOP                 , { = $0000 }
2    CSIDL_INTERNET                , { = $0001 }
3    CSIDL_PROGRAMS                , { = $0002 }
4    CSIDL_CONTROLS                , { = $0003 }
5    CSIDL_PRINTERS                , { = $0004 }
6    CSIDL_PERSONAL                , { = $0005 }
7    CSIDL_FAVORITES               , { = $0006 }
8    CSIDL_STARTUP                 , { = $0007 }
9    CSIDL_RECENT                  , { = $0008 }
10   CSIDL_SENDTO                  , { = $0009 }
11   CSIDL_BITBUCKET               , { = $000a }
12   CSIDL_STARTMENU               , { = $000b }
13   CSIDL_MYDOCUMENTS             , { = $000c }
14    CSIDL_MYMUSIC                 , { = $000d }
15    CSIDL_MYVIDEO                 , { = $000e }
16    CSIDL_DESKTOPDIRECTORY        , { = $0010 }
17    CSIDL_DRIVES                  , { = $0011 }
18    CSIDL_NETWORK                 , { = $0012 }
19    CSIDL_NETHOOD                 , { = $0013 }
20    CSIDL_FONTS                   , { = $0014 }
21    CSIDL_TEMPLATES               , { = $0015 }
22    CSIDL_COMMON_STARTMENU        , { = $0016 }
23    CSIDL_COMMON_PROGRAMS         , { = $0017 }
24    CSIDL_COMMON_STARTUP          , { = $0018 }
25    CSIDL_COMMON_DESKTOPDIRECTORY , { = $0019 }
26    CSIDL_APPDATA                 , { = $001a }
27    CSIDL_PRINTHOOD               , { = $001b }
28    CSIDL_LOCAL_APPDATA           , { = $001c }
29    CSIDL_ALTSTARTUP              , { = $001d }
30    CSIDL_COMMON_ALTSTARTUP       , { = $001e }
31    CSIDL_COMMON_FAVORITES        , { = $001f }
32    CSIDL_INTERNET_CACHE          , { = $0020 }
33    CSIDL_COOKIES                 , { = $0021 }
34    CSIDL_HISTORY                 , { = $0022 }
35    CSIDL_COMMON_APPDATA          , { = $0023 }
36    CSIDL_WINDOWS                 , { = $0024 }
37    CSIDL_SYSTEM                  , { = $0025 }
38    CSIDL_PROGRAM_FILES           , { = $0026 }
39    CSIDL_MYPICTURES              , { = $0027 }
40    CSIDL_PROFILE                 , { = $0028 }
41    CSIDL_SYSTEMX86               , { = $0029 }
42    CSIDL_PROGRAM_FILESX86        , { = $002a }
43    CSIDL_PROGRAM_FILES_COMMON    , { = $002b }
44    CSIDL_PROGRAM_FILES_COMMONX86 , { = $002c }
45    CSIDL_COMMON_TEMPLATES        , { = $002d }
46    CSIDL_COMMON_DOCUMENTS        , { = $002e }
47    CSIDL_COMMON_ADMINTOOLS       , { = $002f }
48    CSIDL_ADMINTOOLS              , { = $0030 }
49    CSIDL_CONNECTIONS             , { = $0031 }
50    CSIDL_COMMON_MUSIC            , { = $0035 }
51    CSIDL_COMMON_PICTURES         , { = $0036 }
52    CSIDL_COMMON_VIDEO            , { = $0037 }
53    CSIDL_RESOURCES               , { = $0038 }
54    CSIDL_RESOURCES_LOCALIZED     , { = $0039 }
55    CSIDL_COMMON_OEM_LINKS        , { = $003a }
56    CSIDL_CDBURN_AREA             , { = $003b }
57    CSIDL_COMPUTERSNEARME         , { = $003d }
58    CSIDL_PROFILES                  { = $003e }
 
对应结果(WIN7操作系统):
0: C:\Users\zhubk\Desktop
2: C:\Users\zhubk\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
5: C:\Users\zhubk\Documents
6: C:\Users\zhubk\Favorites
7: C:\Users\zhubk\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
8: C:\Users\zhubk\AppData\Roaming\Microsoft\Windows\Recent
9: C:\Users\zhubk\AppData\Roaming\Microsoft\Windows\SendTo
11: C:\Users\zhubk\AppData\Roaming\Microsoft\Windows\Start Menu
13: C:\Users\zhubk\Music
14: C:\Users\zhubk\Videos
16: C:\Users\zhubk\Desktop
19: C:\Users\zhubk\AppData\Roaming\Microsoft\Windows\Network Shortcuts
20: C:\Windows\Fonts
21: C:\Users\zhubk\AppData\Roaming\Microsoft\Windows\Templates
22: C:\ProgramData\Microsoft\Windows\Start Menu
23: C:\ProgramData\Microsoft\Windows\Start Menu\Programs
24: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
25: C:\Users\Public\Desktop
26: C:\Users\zhubk\AppData\Roaming
27: C:\Users\zhubk\AppData\Roaming\Microsoft\Windows\Printer Shortcuts
28: C:\Users\zhubk\AppData\Local
29: C:\Users\zhubk\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
30: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
31: C:\Users\zhubk\Favorites
32: C:\Users\zhubk\AppData\Local\Microsoft\Windows\Temporary Internet Files
33: C:\Users\zhubk\AppData\Roaming\Microsoft\Windows\Cookies
34: C:\Users\zhubk\AppData\Local\Microsoft\Windows\History
35: C:\ProgramData
36: C:\Windows
37: C:\Windows\System32
38: C:\Program Files
39: C:\Users\zhubk\Pictures
40: C:\Users\zhubk
41: C:\Windows\System32
42: C:\Program Files
43: C:\Program Files\Common Files
44: C:\Program Files\Common Files
45: C:\ProgramData\Microsoft\Windows\Templates
46: C:\Users\Public\Documents
47: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools
48: C:\Users\zhubk\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools
53: C:\Users\Public\Music
54: C:\Users\Public\Pictures
55: C:\Users\Public\Videos
56: C:\Windows\Resources
59: C:\Users\zhubk\AppData\Local\Microsoft\Windows\Burn\Burn
阅读(601) | 评论(0) | 转发(0) |
0

上一篇:sql搜索

下一篇:没有了

给主人留下些什么吧!~~