开发学院软件开发Delphi 选择一个网路邻居 阅读

选择一个网路邻居

 2006-02-04 13:51:21 来源:WEB开发网   
核心提示:= 选择一个网路邻居 =function SelectComputerName(handle: hwnd; var ComputerName: string): boolean;var BrowseInfo: TBrowseInfo; ItemIDList: PItemIDList; cName: array[0

=================  选择一个网路邻居  =====================
function SelectComputerName(handle: hwnd; var ComputerName: string): boolean;
var
  BrowseInfo: TBrowseInfo;
  ItemIDList: PItemIDList;
  cName: array[0..MAX_PATH] of Char;
  Title: string;
  WindowList: Pointer;
begin
  if Failed(SHGetSpecialFolderLocation(Handle, CSIDL_NETWORK, ItemIDList)) then
   raise Exception.CreateRes(@SComputerNameDialogNotSupported);
  FillChar(BrowseInfo, SizeOf(BrowseInfo), 0);
  BrowseInfo.hwndOwner := Handle;
  BrowseInfo.pidlRoot := ItemIDList;
  BrowseInfo.pszDisplayName := cName;
  Title := '选择计算机名(Remote Server):';
  BrowseInfo.lpszTitle := PChar(Pointer(Title));
  BrowseInfo.ulFlags := BIF_BROWSEFORCOMPUTER;
  WindowList := DisableTaskWindows(0);
  try
   Result := SHBrowseForFolder(BrowseInfo) <> nil;
  finally
   EnableTaskWindows(WindowList);
  end;
  ComputerName := cName;
end;

PRocedure Tfrm_Login.bt_ComputerSetClick(Sender: TObject);
var A_Computer:string;
begin
  if SelectComputerName(handle,A_Computer) then begin
   showMessage( 'the computer's name is :'+ A_Computer ) ;
end;

Tags:选择 一个 网路

编辑录入:爽爽 [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接