Mega Code Archive

 
Categories / Delphi / System
 

How to add special folders to your Windows main menu

Title: How to add special folders to your Windows main menu Question: this is one of those cool things that are almost useles... but anyways, try this code and you'll have acces to your Control Panel and Printers (for now) from you Windows Start Menu Answer: //tested with Delphi 5 and Windows 98 SE //this uses some code from Article 854 //we have to include the Registry and FileCtrl units Uses Registry, FileCtrl; //we use this function to get the special folder "Start Menu" 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; //then, to create the menu to the Control Panel, we would use: ForceDirectories(GetStartMenuDir+'\Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}'); //to create the menu to the Printers we would use: ForceDirectories(GetStartMenuDir+'\Printers.{2227A280-3AEA-1069-A2DE-08002B30309D}') that's it... now you have a menu to those items from you "Start Menu" button(instead of having to open a folder that contains all those items) I'm sure there's posibility to add more special items to the main menu (like, network neighborhood, My Computer, etc), I'll update the article later if you're interested salu2 EberSys