Solved

Dir-path for Start menu\Programs

Posted on 2000-02-28
5
181 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 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

18 Experts available now in Live!

Get 1:1 Help Now