本文整理自网络,侵删。
Delphi获取我的文档路径
//打开"我的电脑"
ShellExecute(0, 'open', '::{20D04FE0-3AEA-1069-A2D8-08002B30309D}', nil, nil, SW_NORMAL);
//打开"网上邻居"
ShellExecute(0, 'open', '::{208D2C60-3AEA-1069-A2D7-08002B30309D}', nil, nil, SW_NORMAL);
//打开"IE浏览器"
ShellExecute(0, 'open', '::{871C5380-42A0-1069-A2EA-08002B30309D}', nil, nil, SW_NORMAL);
//打开"回收站"
ShellExecute(0, 'open', '::{645FF040-5081-101B-9F08-00AA002F954E}', nil, nil, SW_NORMAL);
//打开"我的文档"
ShellExecute(0, 'open', '::{450D8FBA-AD25-11D0-98A8-0800361B1103}', nil, nil, SW_NORMAL);
//打开控制面板
ShellExecute(0, 'open', '::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}', nil, nil, SW_NORMAL);
//打开打印机
ShellExecute(0, 'open', '::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{2227A280-3AEA-1069-A2DE-08002B30309D}', nil, nil, SW_NORMAL);
━━━━━━━━━━━━━━━━━━━━━━━━━━
胡子验证:
如设置默认保存路径为我的文档:
mydocdir:='::{450D8FBA-AD25-11D0-98A8-0800361B1103}';
SaveDialog1.InitialDir:=mydocdir;
━━━━━━━━━━━━━━━━━━━━━━━━━━
uses Registry;
function GetMyDocument: string;
var
reg: TRegistry;
begin
Result := '';
reg := TRegistry.Create;
try
reg.RootKey := HKEY_CURRENT_USER;
if reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',false) then
Result := reg.ReadString('Personal');
reg.CloseKey;
finally
reg.Free;
end;
end;
相关阅读 >>
Delphi idhttp中application/x-www-form-urlencoded字符说明
Delphi stringgrid 实例5 本例功能:字体修改为居中,红色,20号
更多相关阅读请进入《Delphi》频道 >>