Q&A
HOME
Tips & Tech
Q&A
Discuss
Download
자유게시판
홍보 / 광고
구인 / 구직
LOGIN
회원가입
자기 컴퓨터에 연결되어있는 다른 컴퓨터를 검색할려면..
허브를 사용하여 여러대의 컴퓨터를 연결하는 경우에
자기컴퓨터에 연결되어 있는 다른 컴퓨터가 무었인지
알고 싶을때 어떻게 해야 하죠?
가령 6대의 컴퓨터가 연결되어 있으면, 각각의
컴퓨터 이름, 그 컴퓨터의 ip번호를 알아내는 경우입니다.
클라이언트와 서버일 경우에는 서버에게 지금 접속한
클라이언트들이 무었인지 질문을 할수 있지만
동등한 조건으로 연결되어있으면 직접 검색을 해야 할까요?
그럼 좋은 시간 되세요.
답변도 부탁드립니다.
1
COMMENTS
김태균
•
1999.09.01 21:39
이게 도움이 될런지 모르겠네요.
이웃 컴퓨터를 찾는 겁니다.
인터넷이서 다운받은 팁인고 예전에 실행해 봤는데 에러 없이 잘 되더군요.
unit netres_main_unit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,
ComCtrls, StdCtrls, Buttons, Menus, ExtCtrls;
type
TfrmMain = class(TForm)
tvResources: TTreeView;
btnOK: TBitBtn;
btnClose: TBitBtn;
Label1: TLabel;
barBottom: TStatusBar;
popResources: TPopupMenu;
mniExpandAll: TMenuItem;
mniCollapseAll: TMenuItem;
mniSaveToFile: TMenuItem;
mniLoadFromFile: TMenuItem;
grpListType: TRadioGroup;
grpResourceType: TRadioGroup;
dlgOpen: TOpenDialog;
dlgSave: TSaveDialog;
procedure FormCreate(Sender: TObject);
procedure btnCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure mniExpandAllClick(Sender: TObject);
procedure mniCollapseAllClick(Sender: TObject);
procedure mniSaveToFileClick(Sender: TObject);
procedure mniLoadFromFileClick(Sender: TObject);
procedure btnOKClick(Sender: TObject);
private
ListType, ResourceType: DWORD;
procedure ShowHint(Sender: TObject);
procedure DoEnumeration;
procedure DoEnumerationContainer(NetResContainer: TNetResource);
procedure AddContainer(NetRes: TNetResource);
procedure AddShare(TopContainerIndex: Integer; NetRes:
TNetResource);
procedure AddShareString(TopContainerIndex: Integer; ItemName:
String);
procedure AddConnection(NetRes: TNetResource);
public
{ Public declarations }
end;
var
frmMain: TfrmMain;
implementation
{$R *.DFM}
procedure TfrmMain.ShowHint(Sender: TObject);
begin
barBottom.Panels.Items[0].Text:=Application.Hint;
end;
procedure TfrmMain.FormCreate(Sender: TObject);
begin
Application.OnHint:=ShowHint;
barBottom.Panels.Items[0].Text:='';
end;
procedure TfrmMain.btnCloseClick(Sender: TObject);
begin
Close;
end;
{
Enumerate through all network resources:
}
procedure TfrmMain.DoEnumeration;
var
NetRes: Array[0..2] of TNetResource;
Loop: Integer;
r, hEnum, EntryCount, NetResLen: DWORD;
begin
case grpListType.ItemIndex of
{ Connected resources: }
1: ListType:=RESOURCE_CONNECTED;
{ Persistent resources: }
2: ListType:=RESOURCE_REMEMBERED;
{ Global: }
else ListType:=RESOURCE_GLOBALNET;
end;
case grpResourceType.ItemIndex of
{ Disk resources: }
1: ResourceType:=RESOURCETYPE_DISK;
{ Print resources: }
2: ResourceType:=RESOURCETYPE_PRINT;
{ All: }
else ResourceType:=RESOURCETYPE_ANY;
end;
Screen.Cursor:=crHourGlass;
try
{ Delete any old items in the tree view: }
for Loop:=tvResources.Items.Count-1 downto 0 do
tvResources.Items[Loop].Delete;
except
end;
{ Start enumeration: }
r:=WNetOpenEnum(ListType,ResourceType,0,nil,hEnum);
if r<>NO_ERROR then
begin
if r=ERROR_EXTENDED_ERROR then
MessageDlg('Unable to Enumerate the Network.'+#13+
'A network-specific error occurred.',mtError,[mbOK],0)
else
MessageDlg('Unable to Enumerate the Network.',
mtError,[mbOK],0);
Exit;
end;
try
{ We got a valid enumeration handle; walk the resources: }
while (1=1) do
begin
EntryCount:=1;
NetResLen:=SizeOf(NetRes);
r:=WNetEnumResource(hEnum,EntryCount,@NetRes,NetResLen);
case r of
0: begin
{ It's a container, iterate it: }
if NetRes[0].dwUsage=RESOURCEUSAGE_CONTAINER then
DoEnumerationContainer(NetRes[0])
else
{ Persistent and connected resources show up here: }
if ListType in [RESOURCE_REMEMBERED,RESOURCE_CONNECTED]
then
AddConnection(NetRes[0]);
end;
{ Done: }
ERROR_NO_MORE_ITEMS: Break;
{ Other error: }
else begin
MessageDlg('Error Walking Resources.',mtError,[mbOK],0);
Break;
end;
end;
end;
finally
Screen.Cursor:=crDefault;
{ Close enumeration handle: }
WNetCloseEnum(hEnum);
end;
end;
{
Enumerate through the specified container:
This function is usually recursively called.
}
procedure TfrmMain.DoEnumerationContainer(NetResContainer:
TNetResource);
var
NetRes: Array[0..10] of TNetResource;
TopContainerIndex: Integer;
r, hEnum, EntryCount, NetResLen: DWORD;
begin
{ Add container name to tree view: }
AddContainer(NetResContainer);
{ Keep track of this item as current root: }
TopContainerIndex:=tvResources.Items.Count-1;
{ Start enumeration: }
if ListType=RESOURCE_GLOBALNET then
{ Enumerating global net: }
r:=WNetOpenEnum(ListType,ResourceType,RESOURCEUSAGE_CONTAINER,
@NetResContainer,hEnum)
else
{ Enumerating connections or persistent (won't normally get here):
}
r:=WNetOpenEnum(ListType,ResourceType,RESOURCEUSAGE_CONTAINER,
nil,hEnum);
{ Couldn't enumerate through this container; just make a note
of it and continue on: }
if r<>NO_ERROR then
begin
AddShareString(TopContainerIndex,'
(Error #'+
IntToStr(r)+'>');
WNetCloseEnum(hEnum);
Exit;
end;
{ We got a valid enumeration handle; walk the resources: }
while (1=1) do
begin
EntryCount:=1;
NetResLen:=SizeOf(NetRes);
r:=WNetEnumResource(hEnum,EntryCount,@NetRes,NetResLen);
case r of
0: begin
{ Yet another container to enumerate; call this function
recursively to handle it: }
if (NetRes[0].dwUsage=RESOURCEUSAGE_CONTAINER) or
(NetRes[0].dwUsage=10) then
DoEnumerationContainer(NetRes[0])
else
case NetRes[0].dwDisplayType of
{ Top level type: }
RESOURCEDISPLAYTYPE_GENERIC,
RESOURCEDISPLAYTYPE_DOMAIN,
RESOURCEDISPLAYTYPE_SERVER: AddContainer(NetRes[0]);
{ Share: }
RESOURCEDISPLAYTYPE_SHARE:
AddShare(TopContainerIndex,NetRes[0]);
end;
end;
ERROR_NO_MORE_ITEMS: Break;
else begin
MessageDlg('Error #'+IntToStr(r)+' Walking
Resources.',mtError,[mbOK],0);
Break;
end;
end;
end;
{ Close enumeration handle: }
WNetCloseEnum(hEnum);
end;
procedure TfrmMain.FormShow(Sender: TObject);
begin
DoEnumeration;
end;
{
Add item to tree view; indicate that it is a container:
}
procedure TfrmMain.AddContainer(NetRes: TNetResource);
var
ItemName: String;
begin
ItemName:=Trim(String(NetRes.lpRemoteName));
if Trim(String(NetRes.lpComment))<>'' then
begin
if ItemName<>'' then ItemName:=ItemName+' ';
ItemName:=ItemName+'('+String(NetRes.lpComment)+')';
end;
tvResources.Items.Add(tvResources.Selected,ItemName);
end;
{
Add child item to container denoted as current top:
}
procedure TfrmMain.AddShare(TopContainerIndex: Integer; NetRes:
TNetResource);
var
ItemName: String;
begin
ItemName:=Trim(String(NetRes.lpRemoteName));
if Trim(String(NetRes.lpComment))<>'' then
begin
if ItemName<>'' then ItemName:=ItemName+' ';
ItemName:=ItemName+'('+String(NetRes.lpComment)+')';
end;
tvResources.Items.AddChild(tvResources.Items[TopContainerIndex],ItemName);
end;
{
Add child item to container denoted as current top;
this just adds a string for purposes such as being unable
to enumerate a container. That is, the container's shares
are not accessible to us.
}
procedure TfrmMain.AddShareString(TopContainerIndex: Integer;
ItemName: String);
begin
tvResources.Items.AddChild(tvResources.Items[TopContainerIndex],ItemName);
end;
{
Add a connection to the tree view.
Mostly used for persistent and currently connected
resources to be displayed.
}
procedure TfrmMain.AddConnection(NetRes: TNetResource);
var
ItemName: String;
begin
ItemName:=Trim(String(NetRes.lpLocalName));
if Trim(String(NetRes.lpRemoteName))<>'' then
begin
if ItemName<>'' then ItemName:=ItemName+' ';
ItemName:=ItemName+'-> '+Trim(String(NetRes.lpRemoteName));
end;
tvResources.Items.Add(tvResources.Selected,ItemName);
end;
{
Expand all containers in the tree view:
}
procedure TfrmMain.mniExpandAllClick(Sender: TObject);
begin
tvResources.FullExpand;
end;
{
Collapse all containers in the tree view:
}
procedure TfrmMain.mniCollapseAllClick(Sender: TObject);
begin
tvResources.FullCollapse;
end;
{
Allow saving of tree view to a file:
}
procedure TfrmMain.mniSaveToFileClick(Sender: TObject);
begin
if dlgSave.Execute then
tvResources.SaveToFile(dlgSave.FileName);
end;
{
Allow loading of tree view from a file:
}
procedure TfrmMain.mniLoadFromFileClick(Sender: TObject);
begin
if dlgOpen.Execute then
tvResources.LoadFromFile(dlgOpen.FileName);
end;
{
Rebrowse:
}
procedure TfrmMain.btnOKClick(Sender: TObject);
begin
DoEnumeration;
end;
end.
0
0
삭제
수정
댓글
(NOTICE) You must be
logged in
to comment on this post.
조창범
•
1999.09.02 00:25
1
COMMENTS
/
0
LIKES
트리뷰리스트에서 힌트가 안나오게
김영대
•
1999.09.02 00:43
조창범 께서 말씀하시기를... > 트리뷰리스트를 사용하여 프로그램을 했는데.. > 마우스를 포인트를 갖다...
문영철
1999.09.02 00:06
0
COMMENTS
/
0
LIKES
shell API 실행시 prograss Bar 생성방법
신동국
1999.09.01 23:18
0
COMMENTS
/
0
LIKES
서로다른 exe에서 DB connection연결하기
무명인
1999.09.01 22:49
0
COMMENTS
/
0
LIKES
Main Form에서 Sub Form을 여러개 동적생성(긴급!!)
석기명
•
•
1999.09.01 21:25
1
COMMENTS
/
1
LIKES
자기 컴퓨터에 연결되어있는 다른 컴퓨터를 검색할려면..
허브를 사용하여 여러대의 컴퓨터를 연결하는 경우에 자기컴퓨터에 연결되어 있는 다른 컴퓨터가 무었인지 알고 싶을때 어떻게 해야 하죠? 가령 6대의 컴퓨터가 연결되어 있으면, 각각의 컴퓨터 이름, 그 컴퓨터의 ip번호를 알아내는 경우...
김태균
•
1999.09.01 21:39
이게 도움이 될런지 모르겠네요. 이웃 컴퓨터를 찾는 겁니다. 인터넷이서 다운받은 팁인고 예전에 실행해...
김우창
1999.09.01 20:02
0
COMMENTS
/
0
LIKES
웹프로그래밍 전반에 관해 잘써진 책좀 추전해주세요..
조복선
1999.09.01 19:47
0
COMMENTS
/
0
LIKES
콤보박스에 풍선도움말 부여
델초보
•
1999.09.01 19:19
1
COMMENTS
/
0
LIKES
Win32 Error.....
김태균
•
1999.09.01 21:29
win32 error code 는 잘 모르겠구요 nt에서 컴파일 한거를 win98에서 실행하면 에러가 나는 거는 WinNt...
송기원
1999.09.01 19:12
0
COMMENTS
/
0
LIKES
quickReport출력시 오류...
신용탁
1999.09.01 18:28
0
COMMENTS
/
0
LIKES
intallshield에서 오라클 붙이기.
주정길
1999.09.01 17:38
0
COMMENTS
/
0
LIKES
또한번 도움을 요청합니다.
delphi
1999.09.01 17:16
0
COMMENTS
/
0
LIKES
[재질문]스트링그리드멀티셀렉트하기(아시는분 가르쳐주세요..)
전영건
•
1999.09.01 17:07
2
COMMENTS
/
0
LIKES
단축키 사용법?(이정욱님 감사,but...)
jinifan
•
1999.09.04 10:24
전영건 께서 말씀하시기를... > 먼저 이정욱님의 답변을 감사히 잘보았습니다. > > 함수,procedure를 ...
전영건
•
1999.09.04 17:06
> 혹시 Ctrl + MouseUp 을 말씀하시는건 아닌지? > 물론 델4에서요... > > 맞습니다. 잊어 버렸었는데...
혜정
1999.09.01 06:58
0
COMMENTS
/
0
LIKES
메인폼과 서브폼에 대해서(두가지 더 )....
에바_신지
1999.09.01 04:25
0
COMMENTS
/
0
LIKES
F10키를 누르면 메인메뉴의 서브메뉴까지 같이 나타나도록 하고 싶습니다.
강현구
•
1999.09.01 04:18
1
COMMENTS
/
0
LIKES
도와주셔요. 자꾸에러가
강현구
•
1999.09.01 07:33
강현구 께서 말씀하시기를... > 윈98 환경에서 퍼스널 웹서버로 방명록 프로그램을 만들어보고 있습니다. ...
걸음마 초보
1999.09.01 02:53
0
COMMENTS
/
0
LIKES
DB 저장시에 발생하는 데이타 손실...
신용탁
•
1999.09.01 02:09
2
COMMENTS
/
0
LIKES
InstallShield...
박이정
•
1999.09.02 03:17
이런 문제가 흔히 발생하는가 봅니다. 여태까지 저도 고생했거든요. 혹 TDatabase component를 사용하...
김태균
•
1999.09.01 18:50
저도 이런 경험이 있었는데 오라클에서만 이런 문제가 발생하는게 아니고 어떤 DB를 쓰던 일어날 수 있는...
최은경
1999.09.01 01:58
0
COMMENTS
/
0
LIKES
퀵레포트 초보질문
박이정
•
1999.09.01 01:47
2
COMMENTS
/
0
LIKES
인스톨 쉴드이용시 에러...
한근수
•
1999.09.01 18:22
정확한 건 아니지만 참고로 한 번 봐주세요. step 3에서 path가 로 되어있는데, 여기서 정해줘야 하는 ...
박이정
•
1999.09.02 03:07
제가 질문하고 제가 해결했군요.. 그래도 궁금하신 분이 계실 것 같고 빠른 답변을 주신 분께 고마움을 표...
석기명
1999/09/01 21:25
Views
1275
Likes
1
Comments
1
Reports
0
Tag List
수정
삭제
목록으로
한델 로그인 하기
로그인 상태 유지
아직 회원이 아니세요? 가입하세요!
암호를 잊어버리셨나요?
이웃 컴퓨터를 찾는 겁니다.
인터넷이서 다운받은 팁인고 예전에 실행해 봤는데 에러 없이 잘 되더군요.
unit netres_main_unit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,
ComCtrls, StdCtrls, Buttons, Menus, ExtCtrls;
type
TfrmMain = class(TForm)
tvResources: TTreeView;
btnOK: TBitBtn;
btnClose: TBitBtn;
Label1: TLabel;
barBottom: TStatusBar;
popResources: TPopupMenu;
mniExpandAll: TMenuItem;
mniCollapseAll: TMenuItem;
mniSaveToFile: TMenuItem;
mniLoadFromFile: TMenuItem;
grpListType: TRadioGroup;
grpResourceType: TRadioGroup;
dlgOpen: TOpenDialog;
dlgSave: TSaveDialog;
procedure FormCreate(Sender: TObject);
procedure btnCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure mniExpandAllClick(Sender: TObject);
procedure mniCollapseAllClick(Sender: TObject);
procedure mniSaveToFileClick(Sender: TObject);
procedure mniLoadFromFileClick(Sender: TObject);
procedure btnOKClick(Sender: TObject);
private
ListType, ResourceType: DWORD;
procedure ShowHint(Sender: TObject);
procedure DoEnumeration;
procedure DoEnumerationContainer(NetResContainer: TNetResource);
procedure AddContainer(NetRes: TNetResource);
procedure AddShare(TopContainerIndex: Integer; NetRes:
TNetResource);
procedure AddShareString(TopContainerIndex: Integer; ItemName:
String);
procedure AddConnection(NetRes: TNetResource);
public
{ Public declarations }
end;
var
frmMain: TfrmMain;
implementation
{$R *.DFM}
procedure TfrmMain.ShowHint(Sender: TObject);
begin
barBottom.Panels.Items[0].Text:=Application.Hint;
end;
procedure TfrmMain.FormCreate(Sender: TObject);
begin
Application.OnHint:=ShowHint;
barBottom.Panels.Items[0].Text:='';
end;
procedure TfrmMain.btnCloseClick(Sender: TObject);
begin
Close;
end;
{
Enumerate through all network resources:
}
procedure TfrmMain.DoEnumeration;
var
NetRes: Array[0..2] of TNetResource;
Loop: Integer;
r, hEnum, EntryCount, NetResLen: DWORD;
begin
case grpListType.ItemIndex of
{ Connected resources: }
1: ListType:=RESOURCE_CONNECTED;
{ Persistent resources: }
2: ListType:=RESOURCE_REMEMBERED;
{ Global: }
else ListType:=RESOURCE_GLOBALNET;
end;
case grpResourceType.ItemIndex of
{ Disk resources: }
1: ResourceType:=RESOURCETYPE_DISK;
{ Print resources: }
2: ResourceType:=RESOURCETYPE_PRINT;
{ All: }
else ResourceType:=RESOURCETYPE_ANY;
end;
Screen.Cursor:=crHourGlass;
try
{ Delete any old items in the tree view: }
for Loop:=tvResources.Items.Count-1 downto 0 do
tvResources.Items[Loop].Delete;
except
end;
{ Start enumeration: }
r:=WNetOpenEnum(ListType,ResourceType,0,nil,hEnum);
if r<>NO_ERROR then
begin
if r=ERROR_EXTENDED_ERROR then
MessageDlg('Unable to Enumerate the Network.'+#13+
'A network-specific error occurred.',mtError,[mbOK],0)
else
MessageDlg('Unable to Enumerate the Network.',
mtError,[mbOK],0);
Exit;
end;
try
{ We got a valid enumeration handle; walk the resources: }
while (1=1) do
begin
EntryCount:=1;
NetResLen:=SizeOf(NetRes);
r:=WNetEnumResource(hEnum,EntryCount,@NetRes,NetResLen);
case r of
0: begin
{ It's a container, iterate it: }
if NetRes[0].dwUsage=RESOURCEUSAGE_CONTAINER then
DoEnumerationContainer(NetRes[0])
else
{ Persistent and connected resources show up here: }
if ListType in [RESOURCE_REMEMBERED,RESOURCE_CONNECTED]
then
AddConnection(NetRes[0]);
end;
{ Done: }
ERROR_NO_MORE_ITEMS: Break;
{ Other error: }
else begin
MessageDlg('Error Walking Resources.',mtError,[mbOK],0);
Break;
end;
end;
end;
finally
Screen.Cursor:=crDefault;
{ Close enumeration handle: }
WNetCloseEnum(hEnum);
end;
end;
{
Enumerate through the specified container:
This function is usually recursively called.
}
procedure TfrmMain.DoEnumerationContainer(NetResContainer:
TNetResource);
var
NetRes: Array[0..10] of TNetResource;
TopContainerIndex: Integer;
r, hEnum, EntryCount, NetResLen: DWORD;
begin
{ Add container name to tree view: }
AddContainer(NetResContainer);
{ Keep track of this item as current root: }
TopContainerIndex:=tvResources.Items.Count-1;
{ Start enumeration: }
if ListType=RESOURCE_GLOBALNET then
{ Enumerating global net: }
r:=WNetOpenEnum(ListType,ResourceType,RESOURCEUSAGE_CONTAINER,
@NetResContainer,hEnum)
else
{ Enumerating connections or persistent (won't normally get here):
}
r:=WNetOpenEnum(ListType,ResourceType,RESOURCEUSAGE_CONTAINER,
nil,hEnum);
{ Couldn't enumerate through this container; just make a note
of it and continue on: }
if r<>NO_ERROR then
begin
AddShareString(TopContainerIndex,'
(Error #'+
IntToStr(r)+'>');
WNetCloseEnum(hEnum);
Exit;
end;
{ We got a valid enumeration handle; walk the resources: }
while (1=1) do
begin
EntryCount:=1;
NetResLen:=SizeOf(NetRes);
r:=WNetEnumResource(hEnum,EntryCount,@NetRes,NetResLen);
case r of
0: begin
{ Yet another container to enumerate; call this function
recursively to handle it: }
if (NetRes[0].dwUsage=RESOURCEUSAGE_CONTAINER) or
(NetRes[0].dwUsage=10) then
DoEnumerationContainer(NetRes[0])
else
case NetRes[0].dwDisplayType of
{ Top level type: }
RESOURCEDISPLAYTYPE_GENERIC,
RESOURCEDISPLAYTYPE_DOMAIN,
RESOURCEDISPLAYTYPE_SERVER: AddContainer(NetRes[0]);
{ Share: }
RESOURCEDISPLAYTYPE_SHARE:
AddShare(TopContainerIndex,NetRes[0]);
end;
end;
ERROR_NO_MORE_ITEMS: Break;
else begin
MessageDlg('Error #'+IntToStr(r)+' Walking
Resources.',mtError,[mbOK],0);
Break;
end;
end;
end;
{ Close enumeration handle: }
WNetCloseEnum(hEnum);
end;
procedure TfrmMain.FormShow(Sender: TObject);
begin
DoEnumeration;
end;
{
Add item to tree view; indicate that it is a container:
}
procedure TfrmMain.AddContainer(NetRes: TNetResource);
var
ItemName: String;
begin
ItemName:=Trim(String(NetRes.lpRemoteName));
if Trim(String(NetRes.lpComment))<>'' then
begin
if ItemName<>'' then ItemName:=ItemName+' ';
ItemName:=ItemName+'('+String(NetRes.lpComment)+')';
end;
tvResources.Items.Add(tvResources.Selected,ItemName);
end;
{
Add child item to container denoted as current top:
}
procedure TfrmMain.AddShare(TopContainerIndex: Integer; NetRes:
TNetResource);
var
ItemName: String;
begin
ItemName:=Trim(String(NetRes.lpRemoteName));
if Trim(String(NetRes.lpComment))<>'' then
begin
if ItemName<>'' then ItemName:=ItemName+' ';
ItemName:=ItemName+'('+String(NetRes.lpComment)+')';
end;
tvResources.Items.AddChild(tvResources.Items[TopContainerIndex],ItemName);
end;
{
Add child item to container denoted as current top;
this just adds a string for purposes such as being unable
to enumerate a container. That is, the container's shares
are not accessible to us.
}
procedure TfrmMain.AddShareString(TopContainerIndex: Integer;
ItemName: String);
begin
tvResources.Items.AddChild(tvResources.Items[TopContainerIndex],ItemName);
end;
{
Add a connection to the tree view.
Mostly used for persistent and currently connected
resources to be displayed.
}
procedure TfrmMain.AddConnection(NetRes: TNetResource);
var
ItemName: String;
begin
ItemName:=Trim(String(NetRes.lpLocalName));
if Trim(String(NetRes.lpRemoteName))<>'' then
begin
if ItemName<>'' then ItemName:=ItemName+' ';
ItemName:=ItemName+'-> '+Trim(String(NetRes.lpRemoteName));
end;
tvResources.Items.Add(tvResources.Selected,ItemName);
end;
{
Expand all containers in the tree view:
}
procedure TfrmMain.mniExpandAllClick(Sender: TObject);
begin
tvResources.FullExpand;
end;
{
Collapse all containers in the tree view:
}
procedure TfrmMain.mniCollapseAllClick(Sender: TObject);
begin
tvResources.FullCollapse;
end;
{
Allow saving of tree view to a file:
}
procedure TfrmMain.mniSaveToFileClick(Sender: TObject);
begin
if dlgSave.Execute then
tvResources.SaveToFile(dlgSave.FileName);
end;
{
Allow loading of tree view from a file:
}
procedure TfrmMain.mniLoadFromFileClick(Sender: TObject);
begin
if dlgOpen.Execute then
tvResources.LoadFromFile(dlgOpen.FileName);
end;
{
Rebrowse:
}
procedure TfrmMain.btnOKClick(Sender: TObject);
begin
DoEnumeration;
end;
end.