Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Standardordner "Eigene Bilder" (https://www.delphipraxis.net/108682-standardordner-eigene-bilder.html)

stahli 17. Feb 2008 20:05


Standardordner "Eigene Bilder"
 
Wie kann man unter NT ... XP und Vista den Standardordner "Eigene Bilder" ermitteln?
Ich möchte den in OpenPictureDialog entsprechend voreinstellen.

Muss man die Registry durchsuchen?

stahli

Hawkeye219 17. Feb 2008 20:43

Re: Standardordner "Eigene Bilder"
 
Hallo stahli,

in diesem Beitrag solltest du fündig werden.

Gruß Hawkeye

grenzgaenger 17. Feb 2008 20:55

Re: Standardordner "Eigene Bilder"
 
versuch's mal mit
  • CSIDL_MYPICTURES = $27; // Eigene Bilder


Delphi-Quellcode:
FUNCTION GetSpecialFolder(hWindow: HWND; Folder: INTEGER): STRING;
VAR
 pMalloc: IMalloc;
 pidl:   PItemIDList;
 Path:   PChar;
BEGIN
 IF (SHGetMalloc(pMalloc) <> S_OK) THEN
 BEGIN
  MessageBox(hWindow, 'Couldn''t get pointer to IMalloc interface.', 'SHGetMalloc(pMalloc)', 16);
  Exit;
 END;
 SHGetSpecialFolderLocation(hWindow, Folder, pidl);
 GetMem(Path, MAX_PATH);
 SHGetPathFromIDList(pidl, Path);
 Result := Path;
 FreeMem(Path);

 pMalloc.Free(pidl);
END;
<HTH>

stahli 18. Feb 2008 20:46

Re: Standardordner "Eigene Bilder"
 
Hallo grenzgaenger,

danke dafür. Ich dachte, das wäre einfacher - aber es funktioniert :-)

hWindow weise ich 0 zu.

Nach den Units musste ich eine Weile suchen:
- IMalloc ... ActiveX
- PItemIDList u.a. ... ShlObj
- CSIDL_MYPICTURES ... nicht gefunden und daher selbst deklariert

stahli

Matze 18. Feb 2008 21:49

Re: Standardordner "Eigene Bilder"
 
Hallo,

als Ergänzung sei angemerkt, dass genau das in der Code-Library steht. Samt Units und Konstanten. ;)

Grüße

Dani 18. Feb 2008 22:02

Re: Standardordner "Eigene Bilder"
 
Vorsicht, falls SHGetMalloc(pMalloc) <> S_OK wahr wird. Die Funktion liefert dann ein undefiniertes Ergebnis.

ATS3788 2. Jul 2012 15:44

AW: Standardordner "Eigene Bilder"
 
Danke für den Beitrag

http://www.delphipraxis.net/421-pfad...ermitteln.html

:thumb:

Martin Michael

DeddyH 2. Jul 2012 16:00

AW: Standardordner "Eigene Bilder"
 
Nunja, der Beitrag hat 10 Jahre auf dem Buckel, mittlerweile geht das mit MSDN-Library durchsuchenSHGetFolderPath oder MSDN-Library durchsuchenSHGetKnownFolderPath (Unit SHFolder) etwas einfacher.


Alle Zeitangaben in WEZ +1. Es ist jetzt 22:19 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