PDA

View Full Version : پیدا کردن مسیر my pictures



yalameh
شنبه 06 مهر 1387, 09:49 صبح
سلام دوستان
چطوری می توانیم مسیر my pictures را در دلفی بدست آورد .
با تشکر

amin_alexi
شنبه 06 مهر 1387, 11:11 صبح
با اين مسير در Registry مي توني مسير MyPicture رو بدست بياري !


\Software\Microsoft\Windows\CurrentVersion\Explore r\Shell Folders

تو اين مسير خيلي از پوشه هاي ديگه هم هستند !
اين هم كدش !!

Var
Reg: TRegistry;
Begin
Reg:=TRegistry.Create;
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVe rsion\Explorer\Shell Folders', True) then
Result:=Reg.ReadString('My Pictures');
Reg.CloseKey;
Reg.Free;
End;

Cave_Man
شنبه 06 مهر 1387, 11:13 صبح
در ویندوز XP


Uses Windows, ShlObj

function GetSpecialFolder(const CSIDL : integer) : string;
var RecPath : PAnsiChar;
begin
RecPath := StrAlloc(MAX_PATH);
try
FillChar(RecPath^,MAX_PATH,0);
if SHGetSpecialFolderPath(0,RecPath,CSIDL,false) then begin
result := RecPath;
end else result := '';
finally
StrDispose(RecPath);
end;
end;

---

Example:

procedure TForm1.ShowAppDataFolder;
begin
Label1.Caption := GetSpecialFolder($0027);
end;

منابع
http://www.delphi3000.com/articles/article_3759.asp?SK=
http://coding.derkeiler.com/Archive/Delphi/borland.public.delphi.thirdpartytools.general/2005-10/msg00901.html