Registriert seit: 22. Mär 2005
Ort: Dingolfing
4.129 Beiträge
Turbo Delphi für Win32
|
Re: "C:\Programme" ermitteln?
26. Nov 2005, 15:35
Probiers mal damit:
Delphi-Quellcode:
uses ShlObj, ActiveX, SHFolder;
function GetProgramPath: string;
const
CSIDL_PROGRAM_FILES = $26;
var
p: PItemIDLIst;
Buf: array [0..MAX_PATH-1] of Char;
ShellH: IMalloc;
begin
if SHGetSpecialFolderLocation(Application.Handle, CSIDL_PROGRAM_FILES, p) = NOERROR then
try
if SHGetPathFromIDList(p, Buf) then
Result := Buf;
finally
if SHGetMalloc(ShellH) = NOERROR then
ShellH.Free(P);
end;
end;
Manuel Eberl „The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.“
- Terry Pratchett
|