acrph.net

Just another WordPress.com weblog

Delphi: Browse Dialog Function

Syntax: BrowseDialog(sTitle, iFlag)
Returns: string
Examples: BrowseDialog(‘Choose a folder’, BIF_RETURNONLYFSDIRS)

//
function BrowseDialog(const Title: string; const Flag: integer): string;
var
  lpItemID: PItemIDList;
  BrowseInfo: TBrowseInfo;
  DisplayName: array[0..MAX_PATH] of char;
  TempPath: array[0..MAX_PATH] of char;
begin
  Result := ”;
  FillChar(BrowseInfo, sizeof(TBrowseInfo), #0);
  with BrowseInfo do begin
    hwndOwner := Application.Handle;
    pszDisplayName := @DisplayName;
    lpszTitle := PChar(Title);
    ulFlags := Flag;
  end;
  lpItemID := SHBrowseForFolder(BrowseInfo);
  if lpItemId <> nil then begin
    SHGetPathFromIDList(lpItemID, TempPath);
    Result := TempPath;
    GlobalFreePtr(lpItemID);
  end;
end;

April 26, 2008 - Ditulis oleh acrph | Delphi | , | No Comments Yet

Belum ada komentar.

Tinggalkan komentar