【发布时间】:2012-01-03 13:09:04
【问题描述】:
我正在使用 Delphi 7,我想找出我的 .. /All Users/Documents 目录的路径。
我遇到了以下代码
uses shlobj, ...
function GetMyDocuments: string;
var
r: Bool;
path: array[0..Max_Path] of Char;
begin
r := ShGetSpecialFolderPath(0, path, CSIDL_Personal, False) ;
if not r then
raise Exception.Create('Could not find MyDocuments folder location.') ;
Result := Path;
end;
它工作正常,但它不支持返回所需路径的CSIDL_COMMON_DOCUMENTS。
此外,根据 MS,不应再使用 CSIDL,而应使用 KNOWNFOLDERID。
而且我确实需要在多个操作系统(仅限窗口)上运行这个应用程序。
我该怎么做?
感谢您的帮助:)
【问题讨论】: