AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Code-Bibliothek Neuen Beitrag zur Code-Library hinzufügen Delphi Unit zur Verwendung von SHGetKnownFolderPath
Thema durchsuchen
Ansicht
Themen-Optionen

Unit zur Verwendung von SHGetKnownFolderPath

Ein Thema von ringli · begonnen am 11. Jun 2009 · letzter Beitrag vom 19. Sep 2018
 
Fritzew

Registriert seit: 18. Nov 2015
Ort: Kehl
678 Beiträge
 
Delphi 11 Alexandria
 
#5

AW: Unit zur Verwendung von SHGetKnownFolderPath

  Alt 27. Sep 2016, 10:57
Hallo Ringli

Danke für die Unit,

aber eine Anmerkung: Dein Code gibt den Speicher nicht frei.


Ich habe es so geändert:

Delphi-Quellcode:
function GetKnownFolderPath(const rfid: TGUID): string;
var
  OutPath : PWideChar;
begin
  if ShGetKnownFolderPath(rfid, 0, 0, OutPath) {>= 0} = S_OK then
    begin
      Result := OutPath;
// From MSN
// ppszPath [out]
// Type: PWSTR*
// When this method returns, contains the address of a pointer to a null-terminated Unicode string that specifies the path of the known folder
// The calling process is responsible for freeing this resource once it is no longer needed by calling CoTaskMemFree.
// The returned path does not include a trailing backslash. For example, "C:\Users" is returned rather than "C:\Users\".
      CoTaskMemFree(OutPath);
    end
  else
    begin
      Result := '';
    end;
end;
Benötigt auch noch die WinApi.ActiveX im uses.
Fritz Westermann

Geändert von Fritzew (27. Sep 2016 um 11:38 Uhr)
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:41 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz