![]() |
SHBrowseForFolder / NonVCL SelectDirectory - OK/Abbrechen abfangen
Hat sich erledigt ich hab nicht richtig hingeguckt. Wenn man den Dialog abbricht, wird '' zurückgegeben.
Wie kann man bei diesem Code, der einen "Ordner auswählen"-Dialog anzeigt, prüfen, ob man auf OK oder Abbrechen geklickt hat?
Delphi-Quellcode:
class function BrowseForFolder(const browseTitle: string; const initialFolder: string = ''; const appHWND: THandle = 0; mayCreateNewFolder: Boolean = False): string;
var browse_info: TBrowseInfo; folder: array [0 .. MAX_PATH] of char; find_context: PItemIDList; begin FillChar(browse_info, SizeOf(browse_info), #0); lg_StartFolder := initialFolder; browse_info.pszDisplayName := @folder[0]; browse_info.lpszTitle := PChar(browseTitle); browse_info.ulFlags := BIF_RETURNONLYFSDIRS or BIF_NEWDIALOGSTYLE; if not mayCreateNewFolder then browse_info.ulFlags := browse_info.ulFlags or BIF_NONEWFOLDERBUTTON; browse_info.hwndOwner := appHWND; if initialFolder <> '' then browse_info.lpfn := BrowseForFolderCallBack; find_context := SHBrowseForFolder(browse_info); if Assigned(find_context) then begin if SHGetPathFromIDList(find_context, folder) then Result := IncludeTrailingBackslash(folder) else Result := ''; GlobalFreePtr(find_context); end else Result := ''; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:32 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