一个比较全的代码 函数声明 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"