Einzelnen Beitrag anzeigen

Benutzerbild von Luckie
Luckie

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

Domain / Arbeitsgruppen Auswahl-Dialog

  Alt 24. Jun 2007, 03:00
Gibt es auch so einen hübschen Dialog zum auswählen einer Domain, wie den "Computer auswählen"-Dialog im Anhang?

Delphi-Quellcode:
function FindComputer(hWnd: THandle; Prompt: String; csidl: word; var Computer: String): boolean;
const
  BIF_NEWDIALOGSTYLE = $0040;
  BIF_USENEWUI = BIF_NEWDIALOGSTYLE or BIF_EDITBOX;
  BIF_BROWSEINCLUDEURLS = $0080;
  BIF_UAHINT = $0100;
  BIF_NONEWFOLDERBUTTON = $0200;
  BIF_NOTRANSLATETARGETS = $0400;
  BIF_SHAREABLE = $8000;

  BFFM_IUNKNOWN = 5;
  BFFM_SETOKTEXT = WM_USER + 105; // Unicode only
  BFFM_SETEXPANDED = WM_USER + 106; // Unicode only
var
  bi : TBrowseInfo;
  ca : array[0..MAX_PATH] of char;
  pidl, pidlSelected: PItemIDList;
  m : IMalloc;
begin
  if Failed(SHGetSpecialFolderLocation(hWnd, CSIDL_NETWORK, pidl)) then
  begin
    result := False;
    exit;
  end;
  try
    FillChar(bi, SizeOf(bi), 0);
    with bi do
    begin
      hwndOwner := hWnd;
      pidlRoot := pidl;
      pszDisplayName := ca;
      lpszTitle := PChar(Prompt);
      ulFlags := BIF_BROWSEFORCOMPUTER;
    end;
    pidlSelected := SHBrowseForFolder(bi);
    Result := Assigned(pidlSelected);
    if Result then
      Computer := '\\' + string(ca);
  finally
    if Succeeded(SHGetMalloc(m)) then
      m.Free(pidl);
  end;
end;
Miniaturansicht angehängter Grafiken
computersuchen_725.jpg  
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat