Solved

Dir-path for Start menu\Programs

Posted on 2000-02-28
5
183 Views
Last Modified: 2010-04-04
Where in RegEdit can I get the dir-path to \Start menu\Programs ? Platform independent.....

I've looked in RegEdit and found that the path (in RegEdit) isn't the same in 95 and NT. I've also tried to use SHGetSpecialFolderLocation (CSIDL_STARTMENU) but then i miss \programs part.
0
Comment
Question by:espensen
  • 4
5 Comments
 
LVL 2

Expert Comment

by:craig_capel
ID: 2564440
I thought you had to use DDE and talk to explorer to do this......
0
 
LVL 6

Accepted Solution

by:
Jaymol earned 50 total points
ID: 2564450
Type
  TWinDirectory=(wdAppData, wdCache, wdCookies, wdDesktop, wdFavourites,
                 wdFonts, wdHistory, wdNetHood, wdPersonal, wdPrintHood,
                 wdPrograms, wdRecent, wdSendTo, wdStartMenu, wdStartUp,
                 wdTemplates, wdUser);

function       GetWindowsDir(wdDirectoryName : TWinDirectory): String;
begin
      Case wdDirectoryName of
        wdAppData            : Result:=ReadRegString(HKEY_CURRENT_USER,
                                                                                                                'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
                                                'AppData');
        wdCache                  : Result:=ReadRegString(HKEY_CURRENT_USER,
                                                                                                                'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
                                                'Cache');
        wdCookies            : Result:=ReadRegString(HKEY_CURRENT_USER,
                                                                                                                'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
                                                'Cookies');
        wdDesktop            : Result:=ReadRegString(HKEY_CURRENT_USER,
                                                                                                                'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
                                                'Desktop');
        wdFavourites: Result:=ReadRegString(HKEY_CURRENT_USER,
                                                                                                                'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
                                                'Favorites');
        wdFonts                  : Result:=ReadRegString(HKEY_CURRENT_USER,
                                                                                                                'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
                                                'Fonts');
        wdHistory            : Result:=ReadRegString(HKEY_CURRENT_USER,
                                                                                                                'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
                                                'History');
        wdNetHood            : Result:=ReadRegString(HKEY_CURRENT_USER,
                                                                                                                'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
                                                'NetHood');
        wdPersonal      : Result:=ReadRegString(HKEY_CURRENT_USER,
                                                                                                                'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
                                                'Personal');
        wdPrintHood      : Result:=ReadRegString(HKEY_CURRENT_USER,
                                                                                                                'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
                                                'PrintHood');
        wdPrograms      : Result:=ReadRegString(HKEY_CURRENT_USER,
                                                                                                                'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
                                                'Programs');
        wdRecent            : Result:=ReadRegString(HKEY_CURRENT_USER,
                                                                                                                'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
                                                'Recent');
        wdSendTo            : Result:=ReadRegString(HKEY_CURRENT_USER,
                                                                                                                'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
                                                'SendTo');
        wdStartMenu      : Result:=ReadRegString(HKEY_CURRENT_USER,
                                                                                                                'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
                                                'Start Menu');
        wdStartUp            : Result:=ReadRegString(HKEY_CURRENT_USER,
                                                                                                                'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
                                                'StartUp');
        wdTemplates      : Result:=ReadRegString(HKEY_CURRENT_USER,
                                                                                                                'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
                                                'Templates');
  end;
end;

Sorry if that's come out looking a bit bad....but that get's any standard windows directory on any platform.

John.
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 2564454
Sorry....you need ReadRegString as well to make that work....

function      ReadRegString(rHKey: HKey; rKey, rName: String): String;
var
      WinReg      :      TRegistry;
begin
      WinReg:=TRegistry.Create;
  WinReg.RootKey:=rHKey;
  WinReg.OpenKey(rKey, False);
  Result:=WinReg.ReadString(rName);
  WinReg.Free;
end;

That should do the trick.

John.
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 2564456
If you can't be arsed pasting it, let me know and I'll do a unit and send it to you.  Just give me your email address.

John.
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 2564561
Thanks!  You just bumped me over 10,000 points!

John.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now