Главная страница | назад





Article #16870: How can I get the default Windows folders

 Question and Answer Database
FAQ1870D.txt How can I get the default Windows folders
Category :Windows API
Platform :All
Product :All 32 bit
Question:
How can I get the default Windows folders?
Answer:
The following example demonstrates retrieving the entire list of
default shell folders to a TMemo component. The folders retrieved
should include: Favorites, Desktop, Programs, Fonts, SendTo, Start
Menu, Templates, Startup, Recent and NetHood.
Example:
uses Registry;
procedure TForm1.Button1Click(Sender: TObject);
var
reg : TRegistry;
ts : TStrings;
i : integer;
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_CURRENT_USER;
reg.LazyWrite := false;
reg.OpenKey(
'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
false);
ts := TStringList.Create;
reg.GetValueNames(ts);
for i := 0 to ts.Count -1 do begin
Memo1.Lines.Add(ts.Strings[i] +
' = ' +
reg.ReadString(ts.Strings[i]));
end;
ts.Free;
reg.CloseKey;
reg.free;
end;
7/16/98 4:31:28 PM

Last Modified: 01-SEP-99