[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

Network Component

I available any Delphi networking component

1. see all computers in domain / workgroup?
2. can browse the network?

Karen
0
karen021897
Asked:
karen021897
  • 6
  • 5
  • 2
1 Solution
 
kretzschmarCommented:
0
 
karen021897Author Commented:
When i am install this component i get errorr in

SystemViewReg.pas

- Code

procedure Register;
begin
{$IFDEF DFS_STV_SYSTREEVIEW}
  RegisterComponents('DFS', [TSTystemTreeView]);
  RegisterPropertyEditor(TypeInfo(TDFSVersion), TSystemTreeView, 'Version',
     TDFSVersionProperty);
{$ENDIF}
{$IFDEF DFS_STV_SYSLISTVIEW}
  RegisterComponents('DFS', [TSystemListView]);
  RegisterPropertyEditor(TypeInfo(TDFSVersion), TSystemListView, 'Version',
     TDFSVersionProperty);
{$ENDIF}
end;
0
 
karen021897Author Commented:
I want source or component that can see all computer in domain or workgroup and i can my by my self drag and drop computers into listbox1.items
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
intheCommented:
maybe this code will help it shows to enum all pcs on network and put found computers and drives in treeview:

http://www.delphifreestuff.com/examples/wnetexmp.zip

or this code that just adds the found pc names to listview:

procedure TForm1.Button1Click(Sender: TObject);
procedure Enum(h: THandle);
var
  nr: array[0..2000] of TNetResource;
  nRes, cbBuf : Cardinal;
  i: Integer;
  he: THandle;
begin
  nRes := 100;
  cbBuf := sizeof(nr);
  FillChar(nr, sizeof(nr), 0);
  WNetEnumResource(h, nRes, @nr, cbBuf);
  for i := 0 to nRes-1 do
  begin
    if (nr[i].dwDisplayType in [RESOURCEDISPLAYTYPE_DOMAIN,
    RESOURCEDISPLAYTYPE_DIRECTORY,RESOURCEDISPLAYTYPE_SERVER]) and Assigned(nr[i].lpRemoteName) then
     Listbox1.items.add(nr[i].lpRemoteName);
      if nr[i].dwDisplayType in [RESOURCEDISPLAYTYPE_DOMAIN,
RESOURCEDISPLAYTYPE_NETWORK] then
    begin
      WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_DISK,
RESOURCEUSAGE_ALL, @nr[i], he);
      Enum(he);
      WNetCloseEnum(he);
    end;
   end;
end;
var
  he: THandle;
begin
  Listbox1.Items.Clear;
  WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_ANY,
RESOURCEUSAGE_ALL, nil, he);
  Enum(he);
  WNetCloseEnum(he);
end;

Regards Barry
0
 
karen021897Author Commented:
I have to say, you are the best!!!

But, can you do one thing for me

1. Put the list into Treeview

e.g

TOLVDLD // workgroup
TOLV_KAREN // ComputerName
TOLV_POPER // ComputerName

then you are !!! BBBBEEESSSSTTTTT!!!!!!!

Thanx
Karen
0
 
kretzschmarCommented:
well done, barry :-)

sorry karen,
but i didn't had the time to evaluate
your problem with the systree-component,
but i guess that doesn't matter now

meikl
0
 
intheCommented:
hi both,
this is not easy stuff so it might take a while but i see what i can do.
it might be easier to change the
wnetexmp.zip example to just get pc names.well i'll soon see.
back later
 :-))

0
 
intheCommented:
is this better:

procedure TForm1.Button1Click(Sender: TObject);
procedure Enum(h: THandle);
var
  nr: array[0..2000] of TNetResource;
  nRes, cbBuf : Cardinal;
  i: Integer;
  he: THandle;
begin
  nRes := 100;
  cbBuf := sizeof(nr);
  FillChar(nr, sizeof(nr), 0);
  WNetEnumResource(h, nRes, @nr, cbBuf);
  for i := 0 to nRes-1 do
  begin
  if (nr[i].dwDisplayType in [RESOURCEDISPLAYTYPE_DOMAIN]) then
    treeview1.items.add(treeview1.TopItem,pchar(nr[i].lpRemoteName));
    if (nr[i].dwDisplayType in [RESOURCEDISPLAYTYPE_DIRECTORY,RESOURCEDISPLAYTYPE_SERVER]) and Assigned(nr[i].lpRemoteName) then
     treeview1.items.addchild(treeview1.TopItem,pchar(nr[i].lpRemoteName));
      if nr[i].dwDisplayType in [RESOURCEDISPLAYTYPE_DOMAIN,
RESOURCEDISPLAYTYPE_NETWORK] then
    begin
      WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_DISK,
RESOURCEUSAGE_ALL, @nr[i], he);
      Enum(he);
      WNetCloseEnum(he);
    end;
   end;
end;
var
  he: THandle;
begin
  Listbox1.Items.Clear;
  WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_ANY,
RESOURCEUSAGE_ALL, nil, he);
  Enum(he);
  WNetCloseEnum(he);
end;

Regards Barry
merry XMas to all :-))
0
 
intheCommented:
mmm..i think it probably needs more but i cant test anything as i only have 2 pc's on home network so to me it looks fine but on a corporate network with many workgroups it may not be so great..i dunno ..
0
 
karen021897Author Commented:
I get all computers under one "workgroup name" and let's say my computer "tolv_karen" came under
"bokhdld" <--- workgroup name

I will my computer got under "tolvdld"

Is this possible?
0
 
intheCommented:
thats cos i added them here:
treeview1.TopItem  
its harder because like i said i cant test anything cause i only have 1 workgroup and 2 pc's ..
ill have another go later but i wont know if it works or not ..
0
 
intheCommented:
hi,
um did you look to this demo project:
http://www.delphifreestuff.com/examples/wnetexmp.zip

it adds them properly to a treview...
0
 
karen021897Author Commented:
Thanks
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 6
  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now