Autor Beitrag
LonghornUser
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Fr 10.03.06 18:02 
Hallo,

ich muss für ein Programm den Pfad zum Programme-Ordner des Startmenüs ermitteln. Die Rechner, auf denen es laufen soll, sind aber auch Englisch. Deshalb kann ich nicht einfach sagen: GetStartMenuDir+'Programme'.
Eine Funktion fürs bestimmen des Startmenüs alleine hab ich nämlich schon.

Nun die Frage: Mit welcher funktion/Prozedur kann man den o.g. Paf ermitteln ?

Ciao LHUser
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 11.03.06 06:23 
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
const
  CSIDL_PROGRAM_FILES = $0026;
////////////////////////////////////////////////////////////////////////////////
//  GetShellFolder
//  Returns the special shell folders
//  uses: ActiveX, ShlObj;
function GetShellFolder(CSIDL: integer): string;
var
  pidl              : PItemIdList;
  FolderPath        : string;
  SystemFolder      : Integer;
  Malloc            : IMalloc;
begin
  Malloc := nil;
  FolderPath := '';
  SHGetMalloc(Malloc);
  if Malloc = nil then
  begin
    Result := FolderPath;
    Exit;
  end;
  try
    SystemFolder := CSIDL;
    if SUCCEEDED(SHGetSpecialFolderLocation(0, SystemFolder, pidl)) then
    begin
      SetLength(FolderPath, max_path);
      if SHGetPathFromIDList(pidl, PChar(FolderPath)) then
      begin
        SetLength(FolderPath, length(PChar(FolderPath)));
      end;
    end;
    Result := FolderPath;
  finally
    Malloc.Free(pidl);
  end;
end;


Die Suche hätte es aber auch getan.
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Sa 11.03.06 13:29 
Danke. Geht dieser Code unter allen Windows-Versionen ?
Hux
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 171



BeitragVerfasst: Mo 13.03.06 14:56 
ja klar!
Weil sonst könnte man es ja gleich aus der Registry auslesen...
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 13.03.06 19:17 
Mein:
Zitat:
Minimum DLL Version: shell32.dll version 4.0 or later

Und die hängt wohl vom installierten Internet Explorer ab.