Choose a network neighbor

xiaoxiao2021-03-06  59

================= Choose a network neighbor =================================================================================================================================================================================================================== 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: = 'select the computer name (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;

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;

转载请注明原文地址:https://www.9cbs.com/read-109173.html

New Post(0)