精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>● Delphi>>Delphi 网络编程>>浏览计算机

主题:浏览计算机
发信人: teleme(PassWord)
整理人: teleme(2001-05-29 20:04:27), 站内信件
function BrowseForComputer(const winhandle: THANDLE; const title: string): string;

var
   BrowseInfo: TBrowseInfo;
   IDRoot: PItemIDList;
   Path: array[0..MAX_PATH] of Char;
begin
   // Get the Item ID for Network Neighborhood
   SHGetSpecialFolderLocation(winHandle, CSIDL_NETWORK, IDRoot);
   ZeroMemory(@BrowseInfo, SizeOf(TBrowseInfo));
   ZeroMemory(@path, MAX_PATH);
   BrowseInfo.hwndOwner := winhandle;
   BrowseInfo.pidlRoot := IDRoot;
   BrowseInfo.lpszTitle := PChar(title);
   BrowseInfo.pszDisplayName := @path;
   // Include this flag to show computer only
   BrowseInfo.ulFlags := BIF_BROWSEFORCOMPUTER; // or BIF_RETURNONLYFSDIRS   ;
   // Show the browse dialog, get the Item ID for the selected item and convert it to a path
   SHBrowseForFolder(BrowseInfo);
   //  SHGetPathFromIDList(IDList, Path);
   result := path;
end;

//参数说明
//winhandle句柄,可以指定为窗体句柄页可以指定为0


//title浏览框得标题


//例子 showmessage(BrowseForComputer(Form1.Handle , '选择计算机'));



----
忙,忙,忙。 
忙,忙,忙。
忙,忙,忙。
 
再忙也得告诉我
  

[关闭][返回]