Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Pfad zu Application Data herauslesen (https://www.delphipraxis.net/61058-pfad-zu-application-data-herauslesen.html)

Flinto 18. Jan 2006 08:50

Re: Pfad zu Application Data herauslesen
 
Also die version meiner shell32.dll ist 6.0. Das sollte
also kein Problem sein.
Kann man dann sagen ab welcher Window Version die
shell32.dll Version sicher 5.0 oder höher ist??
Oder gibt es sonst noch eine andere Möglichkeit
diese Systempfade herauszulesen??

Sharky 18. Jan 2006 09:03

Re: Pfad zu Application Data herauslesen
 
Hai Flinton,

bei mir läuft es ab Windows 2000 prof. aufwärts. Unter Win 98 geht es nicht. Ein Win ME habe ich nicht installiert.

marabu 18. Jan 2006 09:16

Re: Pfad zu Application Data herauslesen
 
Ich habe mal eben D5 angeworfen:

Delphi-Quellcode:
program Demo;
{$APPTYPE CONSOLE}
uses
  Windows,
  SysUtils,
  ActiveX,
  ShlObj;

function IncludeTrailingPathDelimiter(path: String): String;
begin
  Result := IncludeTrailingBackslash(path);
end;

function GetSpecialFolderLocation(csidl: integer): string;
var
  pMalloc: IMalloc;
  pidl: PItemIDList;
  path: array [0..MAX_PATH] of Char;
begin
  Result := '?';
  if SHGetMalloc(pMalloc) = S_OK then
  begin
    SHGetSpecialFolderLocation(0, csidl, pidl);
    SHGetPathFromIDList(pidl, path);
    Result := IncludeTrailingPathDelimiter(Path);
    pMalloc.Free(pidl);
  end;
end;

begin
  WriteLn(GetSpecialFolderLocation($23));
end.
Das Herzstück ist der API-Call SHGetSpecialFolderLocation() und zu dem sagt der Windows Platform SDK:

Code:
Minimum DLL Version shell32.dll  version 4.7 or later
Custom Implementation            No
Header                           shlobj.h
Import library                   shell32.lib
Minimum operating systems        Windows NT 4.0, Windows 95
marabu

Sharky 18. Jan 2006 09:21

Re: Pfad zu Application Data herauslesen
 
Zitat:

Zitat von marabu
...
Das Herzstück ist der API-Call SHGetSpecialFolderLocation() und zu dem sagt der Windows Platform SDK:
Minimum DLL Version shell32.dll version 4.7 or later

Jup.

Aber zu CSIDL_COMMON_APPDATA sagt das SDK

Zitat:

CSIDL_COMMON_APPDATA (0x0023)
Version 5.0. The file system directory containing application data for all users. A typical path is C:\Documents and Settings\All Users\Application Data.
Und darum dachte ich das für diese Funktion min. Version 5 der DLL vorhanden sein muss.

MathiasSimmack 18. Jan 2006 10:05

Re: Pfad zu Application Data herauslesen
 
Da hast du auch richtig gedacht, Sharky. :)

Die Konstante CSIDL_COMMON_APPDATA gibt es erst ab Windows 2000. Im PSDK findet man eine Übersicht, welche shell32.dll-Version welcher Windows-Version beiliegt.

Christian Seehase 18. Jan 2006 17:57

Re: Pfad zu Application Data herauslesen
 
Moin Zusammen,

Zitat:

Zitat von MathiasSimmack
Im PSDK findet man eine Übersicht, welche shell32.dll-Version welcher Windows-Version beiliegt.

und welchen Wert man für die jeweilige Konstante braucht, um das Verzeichnis auslesen zu lassen, falls die benutzte Delphi-Version diese nicht bereits implementiert hat.

slemke76 4. Mai 2007 15:45

Re: Pfad zu Application Data herauslesen
 
Hallo,

Zitat:

Zitat von marabu
die in deiner Unit SHLOBJ offensichtlich fehlen. Das geht so:
Delphi-Quellcode:
const
  CSIDL_COMMON_APPDATA = $0023;

Habe gerade mal unter D7 im Programmverzeichnis nach CSIDL gesucht.
In
Delphi-Quellcode:
uses SHFolder
ist CSIDL_COMMON_APPDATA enthalten.

lg
Sebastian


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:37 Uhr.
Seite 2 von 2     12   

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