函数声明
Function long SHGetSpecialFolderLocation (Long
hwndOwner, Integer nFolder, ref Long ppidl) library
"shell32.dll"
Function long SHGetPathFromIDList(long pidl, ref String
szPath) library "shell32.dll" Alias for "SHGetPathFromIDListA"
Function
long GetWindowsDirectory (ref String lPBuffer, Long nSize) Library "kernel32"
Alias for "GetWindowsDirectoryA"
Function long GetSystemDirectory (ref
String lpBuffer, Long nSize) Library "kernel32" Alias for
"GetSystemDirectoryA"
Function long GetTempPath (Long nBufferLength, ref
String lpBuffer) Library "kernel32" Alias for
"GetTempPathA"
代码
Constant integer MAX_LEN =
200//字符串最大长度
Constant integer DESKTOP = 0//桌面
Constant integer
PROGRAMS = 2//程序集
Constant integer MYDOCUMENTS = 5//我的文档
Constant
integer MYFAVORITES = 6//收藏夹
Constant integer STARTUP =
7//启动
Constant integer RECENT = 8//最近打开的文件
Constant integer SENDTO
= 9//发送
Constant integer STARTMENU = 11 //开始菜单
Constant integer
NETHOOD = 19//网上邻居
Constant integer FONTS = 20//字体
Constant
integer SHELLNEW = 21//ShellNew
Constant integer APPDATA =
26//Application Data
Constant integer PRINTHOOD =
28//PrintHood
Constant integer PAGETMP = 32//网页临时文件
Constant
integer COOKIES = 33//Cookies目录
Constant integer HISTORY =
34//历史
StringsTmp
//存放结果的固定长度的字符串
LongLength//字符串的实际长度
Longpidl//某特殊目录在特殊目录列表中的位置
Stringls_data,
ls_path
//获得Windows目录
sTmp = space(200)
Length =
GetWindowsDirectory(sTmp, MAX_LEN)
ls_path = Left(sTmp,
Length)
ls_data += ls_path + "~r~n"
//获得System目录
sTmp =
space(200)
Length = GetSystemDirectory(sTmp, MAX_LEN)
ls_path =
Left(sTmp, Length)
ls_data += ls_path +
"~r~n"
//获得Temp目录
sTmp = space(200)
Length =
GetTempPath(MAX_LEN, sTmp)
ls_path = Left(sTmp, Length)
ls_data +=
ls_path + "~r~n"
//获得DeskTop目录
SHGetSpecialFolderLocation(0,
DESKTOP, pidl)
SHGetPathFromIDList(pidl, sTmp)
ls_path =
sTmp
ls_data += ls_path +
"~r~n"
//获得发送到目录
SHGetSpecialFolderLocation(0, SENDTO,
pidl)
SHGetPathFromIDList(pidl, sTmp)
ls_path =
sTmp
ls_data += ls_path +
"~r~n"
//获得我的文档目录
SHGetSpecialFolderLocation(0, MYDOCUMENTS,
pidl)
SHGetPathFromIDList(pidl, sTmp)
ls_path =
sTmp
ls_data += ls_path +
"~r~n"
//获得程序集目录
SHGetSpecialFolderLocation(0, PROGRAMS,
pidl)
SHGetPathFromIDList(pidl, sTmp)
ls_path =
sTmp
ls_data += ls_path +
"~r~n"
//获得启动目录
SHGetSpecialFolderLocation(0, STARTUP,
pidl)
SHGetPathFromIDList(pidl, sTmp)
ls_path =
sTmp
ls_data += ls_path +
"~r~n"
//获得开始菜单目录
SHGetSpecialFolderLocation(0, STARTMENU,
pidl)
SHGetPathFromIDList(pidl, sTmp)
ls_path =
sTmp
ls_data += ls_path +
"~r~n"
//获得收藏夹目录
SHGetSpecialFolderLocation(0, MYFAVORITES,
pidl)
SHGetPathFromIDList(pidl, sTmp)
ls_path =
sTmp
ls_data += ls_path +
"~r~n"
//获得最后打开的文件目录
SHGetSpecialFolderLocation(0, RECENT,
pidl)
SHGetPathFromIDList(pidl, sTmp)
ls_path =
sTmp
ls_data += ls_path +
"~r~n"
//获得网上邻居目录
SHGetSpecialFolderLocation(0, NETHOOD,
pidl)
SHGetPathFromIDList(pidl, sTmp)
ls_path =
sTmp
ls_data += ls_path +
"~r~n"
//获得字体目录
SHGetSpecialFolderLocation(0, FONTS,
pidl)
SHGetPathFromIDList(pidl, sTmp)
ls_path =
sTmp
ls_data += ls_path +
"~r~n"
//获得Cookies目录
SHGetSpecialFolderLocation(0, COOKIES,
pidl)
SHGetPathFromIDList(pidl, sTmp)
ls_path =
sTmp
ls_data += ls_path +
"~r~n"
//获得历史目录
SHGetSpecialFolderLocation(0, HISTORY,
pidl)
SHGetPathFromIDList(pidl, sTmp)
ls_path =
sTmp
ls_data += ls_path +
"~r~n"
//获得网页临时文件目录
SHGetSpecialFolderLocation(0, PAGETMP,
pidl)
SHGetPathFromIDList(pidl, sTmp)
ls_path =
sTmp
ls_data += ls_path +
"~r~n"
//获得ShellNew目录
SHGetSpecialFolderLocation(0, SHELLNEW,
pidl)
SHGetPathFromIDList(pidl, sTmp)
ls_path =
sTmp
ls_data += ls_path + "~r~n"
//获得Application
Data目录
SHGetSpecialFolderLocation(0, APPDATA,
pidl)
SHGetPathFromIDList(pidl, sTmp)
ls_path =
sTmp
ls_data += ls_path +
"~r~n"
//获得PrintHood目录
SHGetSpecialFolderLocation(0, PRINTHOOD,
pidl)
SHGetPathFromIDList(pidl, sTmp)
ls_path =
sTmp
ls_data += ls_path + "~r~n"
messagebox('', ls_data)
阅读(3471) | 评论(0) | 转发(0) |