我的电脑:SaveDialog1.InitialDir := '::{20D04FE0-3AEA-1069-A2D8-08002B30309D}'; // My Computer {20D04FE0-3AEA-1069-A2D8-08002B30309D} // Network Neighborhood {208D2C60-3AEA-1069-A2D7-08002B30309D} // Recycled {645FF040-5081-101B-9F08-00AA002F954E}
另外可使用SHGetSpecialFolder获取其它Windows虚拟文件夹,相关函数和常数定义于ShlObj。 如下面程序打开最近访问文件夹: procedure TForm1.Button1Click(Sender: TObject); var PIDL: Pointer; Path: LPSTR; const CSIDL_RECENT = $0008; begin Path := StrAlloc(MAX_PATH); SHGetSpecialFolderLocation(Handle, CSIDL_RECENT, @PIDL); if SHGetPathFromIDList(PIDL, Path) then // returns false if folder isn't part of file system begin OpenDialog1.InitialDir := Path; OpenDialog1.Execute; end; StrDispose(Path); end;
|
请发表评论