Mega Code Archive

 
Categories / Delphi / Files
 

Getting the path of the Start Menu directory

Title: Getting the path of the Start Menu directory Question: How do I get the path of the Start Menu's Programs directory? Answer: System directory info is held in the registry at 'HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\', so its very easy to get them. The code to do this is: function GetStartMenuDir: String; var Reg: TRegistry; tempstr: String; begin Reg := TRegistry.Create; try Reg.RootKey := HKey_Current_User; if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion' + '\Explorer\Shell Folders', FALSE) then tempstr := Reg.ReadString('Start Menu'); finally Reg.Free; end; Result := tempstr; end; The list of of all the values in that key are (brackets are description of the not so obvious ones): Desktop Programs (Start Menu\Programs) Fonts SendTo Start Menu Startup Recent Favorites Personal (My Documents) Templates (Windows\ShellNew) NetHood AppData (Windows\Application Data) Cache (Temporary Internet Files) Cookies History My Pictures Local AppData (Local Settings\Application Data) Tested on Windows 95 with Delphi 4. Should work fine on any 32bit version of windows or delphi.