给自己一点时间接受自己,爱自己,趁着下午茶的时间来学习图老师推荐的选择一个网路邻居,过去的都会过去,迎接崭新的开始,释放更美好的自己。
【 tulaoshi.com - 编程语言 】
================= 选择一个网路邻居 =====================
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;
来源:http://www.tulaoshi.com/n/20160219/1603850.html