Autor Beitrag
pHleX
Hält's aus hier
Beiträge: 3



BeitragVerfasst: Fr 31.08.07 22:24 
hallo :)

Ich meine - C ist nicht immer C und Programme ist nicht immer Programme (Program Files,...). Genauso wird - wenn ich die 2 "gefunden" hab der Ordner Gemeinsame Dateien bei den Englischen versionen wohl auch nicht so heißen ;)

Gibt es eine Möglichkeit diesen zu finden?
Calculon
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 676

Win XP Professional
Delphi 7 PE, Delphi 3 PRO
BeitragVerfasst: Sa 01.09.07 03:11 
Ja, die gibt es (Code aus der DP):

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:
uses [..],ActiveX, ShellAPI, ShlObj, Shfolder;

[..]

function GetSpecialFolder(hWindow: HWND; Folder: Integer): String;
var
  pMalloc: IMalloc;
  pidl: PItemIDList;
  Path: PChar;
begin
  // get IMalloc interface pointer
  if (SHGetMalloc(pMalloc) <> S_OK) then
  begin
    MessageBox(hWindow, 'Couldn''t get pointer to IMalloc interface.',
               'SHGetMalloc(pMalloc)', 16);
    Exit;
  end;

  // retrieve path
  SHGetSpecialFolderLocation(hWindow, Folder, pidl);
  GetMem(Path, MAX_PATH);
  SHGetPathFromIDList(pidl, Path);
  Result := Path;
  FreeMem(Path);

  // free memory allocated by SHGetSpecialFolderLocation
  pMalloc.Free(pidl);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage(GetSpecialFolder(Handle, CSIDL_PROGRAM_FILES_COMMON));
end;


Gruß

Calculon
--
pHleX Threadstarter
Hält's aus hier
Beiträge: 3



BeitragVerfasst: So 02.09.07 02:40 
perfekt!
vielen dank!
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 02.09.07 22:18 
Moin!

Dazu haben wir natürlich auch einen eigenen FAQ-Beitrag! :D

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.