Link to home
Start Free TrialLog in
Avatar of karen021897
karen021897

asked on

Network Component

I available any Delphi networking component

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

Karen
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Avatar of karen021897
karen021897

ASKER

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;
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
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
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
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
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
 :-))

ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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 ..
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?
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 ..
hi,
um did you look to this demo project:
http://www.delphifreestuff.com/examples/wnetexmp.zip

it adds them properly to a treview...
Thanks