Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Desktop Pfad (https://www.delphipraxis.net/20305-desktop-pfad.html)

SleepyMaster 15. Apr 2004 22:20


Desktop Pfad
 
Hi ihrs

wurde zwar bestimmt schon tausend mal gefragt, mir fehlen aber die ruchtigen Stichpunkte.
Weiß jemand wie man den Pfad vom Desktop des angemeldeten/beliebigen benutzers herausfinden kann.

Gruß Lars

SleepyMaster 15. Apr 2004 22:29

Re: Desktop Pfad
 
OK! Hat sich erledigt!

Delphi-Quellcode:



uses
  ActiveX, ShlObj;

function GetDeskTopPath : string;
var
  shellMalloc: IMalloc;
  ppidl: PItemIdList;
  PerDir: string;
begin
  ppidl := nil;
  try
    if SHGetMalloc(shellMalloc) = NOERROR then
    begin
      SHGetSpecialFolderLocation(Form1.Handle, CSIDL_DESKTOP, ppidl);
      SetLength(Result, MAX_PATH);
      if not SHGetPathFromIDList(ppidl, PChar(Result)) then
        raise exception.create('SHGetPathFromIDList failed : invalid pidl');
      SetLength(Result, lStrLen(PChar(Result)));
    end;
  finally
   if ppidl <> nil then
         shellMalloc.free(ppidl);
  end;
end;

fkerber 15. Apr 2004 22:30

Re: Desktop Pfad
 
Hi!

Hier im Forum suchenshgetspecialfolderlocation

Ciao fkerber


Alle Zeitangaben in WEZ +1. Es ist jetzt 20:26 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz