Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Dir-path for Start menu\Programs

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Mydac connection data base issue 3 166
Delphi XE10 Round Image 2 155
Unique identifier on a terminal server (rdp) 4 67
How to load 2 images in same column in Delphi 2 57
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

860 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