Einzelnen Beitrag anzeigen

Micha88
(Gast)

n/a Beiträge
 
#6

AW: Pfad nimmt String nicht.

  Alt 12. Nov 2011, 19:58
Zum beispiel so (Kopie, nicht mein Code)

Delphi-Quellcode:
uses
 ShlObj, ActiveX, ShellApi;
{ ... }
function GetSpecialFolder(const AFolder: Integer): String;
var
  ItemIDList: PItemIDList;
  hPath: PChar;
  ShellH: IMalloc;
begin
  if SUCCEEDED(SHGetSpecialFolderLocation(Application.Handle, AFolder, ItemIDList)) then
  begin
    try
      hPath:= StrAlloc(max_path);
      try
        if SHGetPathFromIDList (ItemIDList, hPath) then
          Result:=hPath;
      finally
        StrDispose(hPath);
      end;
    finally
     if SHGetMalloc(ShellH) = NOERROR then
       ShellH.Free(ItemIDList);
    end;
  end
  else
    RaiseLastOSError;
end;
  Mit Zitat antworten Zitat