AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Programm Ordner finden

Ein Thema von SaFu · begonnen am 6. Apr 2008 · letzter Beitrag vom 6. Apr 2008
Antwort Antwort
Seite 3 von 3     123   
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#21

Re: Programm Ordner finden

  Alt 6. Apr 2008, 17:00
Zitat von hathor:
Zitat von SirThornberry:
@hathor: Warum SHGetSpecialFolderLocation anstelle von SHGetSpecialFolderPath? Mit SHGetSpecialFolderPath ginge das ganze bedeutend einfacher.
The reason for using SHGetSpecialFolderLocation instead of SHGetSpecialFolderPath is that the second is only available from the version 4.71 (Internet Explorer 4) of the Shell32.dll while the first is present on all systems starting with NT 4 and Win 95.
Und im SDK steht:
Zitat:
With Microsoft Windows 2000, this function is superseded by ShGetFolderPath. You can use this function on earlier systems by including the redistributable DLL, ShFolder.dll.
Ergo ist es besser MSDN-Library durchsuchenSHGetFolderPath zu benutzen. Ein Support von Windows 95 und Windows NT 4 ist nun wirklich nicht mehr von Nöten.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#22

Re: Programm Ordner finden

  Alt 6. Apr 2008, 17:23
Ich habe das mal eben implementiert:
Delphi-Quellcode:
function SHGetFolderPathW(hwndOwner: HWND; nFolder: Integer; hToken: THandle; dwFlags: DWORD; pszPath: LPWSTR):
  HRESULT; stdcall; external 'shell32.dllname 'SHGetFolderPathW';

const
  SHGFP_TYPE_CURRENT = 0;

const
  CSIDL_FLAG_CREATE = $8000;
  CSIDL_ADMINTOOLS = $0030;
  CSIDL_ALTSTARTUP = $001D;
  CSIDL_APPDATA = $001A;
  CSIDL_BITBUCKET = $000A;
  CSIDL_CDBURN_AREA = $003B;
  CSIDL_COMMON_ADMINTOOLS = $002F;
  CSIDL_COMMON_ALTSTARTUP = $001E;
  CSIDL_COMMON_APPDATA = $0023;
  CSIDL_COMMON_DESKTOPDIRECTORY = $0019;
  CSIDL_COMMON_DOCUMENTS = $002E;
  CSIDL_COMMON_FAVORITES = $001F;
  CSIDL_COMMON_MUSIC = $0035;
  CSIDL_COMMON_PICTURES = $0036;
  CSIDL_COMMON_PROGRAMS = $0017;
  CSIDL_COMMON_STARTMENU = $0016;
  CSIDL_COMMON_STARTUP = $0018;
  CSIDL_COMMON_TEMPLATES = $002D;
  CSIDL_COMMON_VIDEO = $0037;
  CSIDL_CONTROLS = $0003;
  CSIDL_COOKIES = $0021;
  CSIDL_DESKTOP = $0000;
  CSIDL_DESKTOPDIRECTORY = $0010;
  CSIDL_DRIVES = $0011;
  CSIDL_FAVORITES = $0006;
  CSIDL_FONTS = $0014;
  CSIDL_HISTORY = $0022;
  CSIDL_INTERNET = $0001;
  CSIDL_INTERNET_CACHE = $0020;
  CSIDL_LOCAL_APPDATA = $001C;
  CSIDL_MYDOCUMENTS = $000C;
  CSIDL_MYMUSIC = $000D;
  CSIDL_MYPICTURES = $0027;
  CSIDL_MYVIDEO = $000E;
  CSIDL_NETHOOD = $0013;
  CSIDL_NETWORK = $0012;
  CSIDL_PERSONAL = $0005;
  CSIDL_PRINTERS = $0004;
  CSIDL_PRINTHOOD = $001B;
  CSIDL_PROFILE = $0028;
  CSIDL_PROFILES = $003E;
  CSIDL_PROGRAM_FILES = $0026;
  CSIDL_PROGRAM_FILES_COMMON = $002B;
  CSIDL_PROGRAMS = $0002;
  CSIDL_RECENT = $0008;
  CSIDL_SENDTO = $0009;
  CSIDL_STARTMENU = $000B;
  CSIDL_STARTUP = $0007;
  CSIDL_SYSTEM = $0025;
  CSIDL_TEMPLATES = $0015;
  CSIDL_WINDOWS = $0024;

function GetSpecialFolder(HandleOwner: THandle; Folder: Integer): WideString;
var
  Res : HRESULT;
  Buffer : array[0..MAX_PATH - 1] of WCHAR;
begin
  Result := '';
  Res := SHGetFolderPathW(HandleOwner, Folder, 0, SHGFP_TYPE_CURRENT, Buffer);
  if Res = S_OK then
  begin
    Result := WideString(Buffer);
  end;
end;
Gibt es auch als Ansi-Version, aber ich denke, man sollte schon frühzeitig Unicode unterstützen - es kann ja nichts schaden.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
s-off
(Gast)

n/a Beiträge
 
#23

Re: Programm Ordner finden

  Alt 6. Apr 2008, 18:13
[OT]
Zitat von Luckie:
Ein Support von Windows 95 und Windows NT 4 ist nun wirklich nicht mehr von Nöten.
Da gebe ich Dir recht, erinnert mich aber daran, dass einer unserer Kunden noch bis vor einem knappen Jahr mit Windows 3.11 gearbeitet hat
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 3 von 3     123   


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 05:59 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