LAN,After,searching,without,results,year,litt
Quick Search for:  in language:    
LAN,After,searching,without,results,year,litt
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
RentACoder Stats

 Code:  lines
 Jobs: 0 postings

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for RentACoder.
Wrapping Scrolling Text
By Paranoid_Androi d on 7/2


Create A Dummy File
By AML on 7/2


Click here to see a screenshot of this code!Captionbar manipulation!
By Peter Hebels on 7/2

(Screen Shot)

A Game Of War
By Co0nest on 7/2


Click here to see a screenshot of this code!KeyGen Example
By Bengie|NET on 7/2

(Screen Shot)

Click here to see a screenshot of this code!OpenBrowser v1.9
By Orlando Jerez on 7/2

(Screen Shot)

SendMessageBySt ring() Example
By Jaime Muscatelli on 7/2


Click here to see a screenshot of this code!FirstSunday
By Jan Paul Penning on 7/2

(Screen Shot)

Click here to see a screenshot of this code!Ikonz v1.0
By Gaurav Creations on 7/2

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

Show all Domains and Computers in LAN

Print
Email
 
winzip icon
Submitted on: 2/10/2001 7:46:09 AM
By: Mark van Renswoude  
Level: Intermediate
User Rating: By 15 Users
Compatibility:

Users have accessed this code 13535 times.
 

 
     After searching for this without results for about a year, I put all little bits of code I have found together and created these two Class Modules. One Class Module handles the enumeration of the Domains / Workgroups in your LAN, the other handles the enumeration of the Computers available in a specific domain. Included is a small demonstration program (as shown in the screenshot). Because of the Class Modules, you can easily add this functionality to any other program. This has only been tested on Win98 SE (so it does work on Win98, not like most other examples I have found, they only worked on WinNT). If anyone has problems with the enumeration on certain systems, please let me know so I can work it out. As usual, please leave comments, and vote if you like.

 

Windows API/Global Declarations:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!

    //**************************************
    //     
    //Windows API/Global Declarations for :S
    //     how all Domains and Computers in LAN
    //**************************************
    //     
    All in the class modules.
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzipto decompress it.

Virus note:All files are scanned once-a-day by Planet Source Code for viruses,but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:
1)Re-scan downloaded files using your personal virus checker before using it.
2)NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for langauges that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 7 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
2/10/2001 9:18:33 AM:Scott
We have 79 domains here.  This code is 
very slow if there are a lot of network 
nodes.  It might be fine to use on a 
network with under 100 machines.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/10/2001 9:25:11 AM:Powersoft Programming
I don't know if that problem is in my 
code or not. As far as I can see, 
there's not much to slow it down in the 
code itself. This could be slown down 
by Windows, because it has to find all 
computers in all domains (which may use 
a lot of communicating in your 
network). If you have other programs 
which do the same faster, then I'm 
probably wrong. If you know ways of 
speeding this up (if possible), please 
let me know too...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/10/2001 11:30:50 AM:Tim Miron
Yea, i agree with Powersoft, this code 
works fine on our network, I give ya 5 
STARS!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/11/2001 8:31:48 PM:AGP
Ive created a VB program that does 
somehting like this. It finds domains 
and computers on those domains. It 
actually does searches for files on the 
network. It is completely freeware at 
www.WarpEngine.com. I actually used 
snippets of code from PlanetSourceCode 
to make the network engine. You might 
try my program to see if it could be 
the code thats slowing it down. Typical 
use for my program is at LAN parties 
with more than 300 machines. Im gonna 
check out PowerSoft's code though cause 
ive had some minor problems with my 
code. Always looking to refine my 
programs and like i said its complete 
freeware.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2001 3:13:52 AM:Plasma
can we get s/c for ya proggie AGP? :D
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2001 5:04:28 AM:Matrix
I got this error when I run 
it.
Runtime error 7773 
"Could not 
enumerate computers in domain!
BTW, 
I'm using windows NT 4.
How can I 
execute this properly?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2001 6:33:44 AM:Powersoft Programming
This is what causing it (Refresh sub in 
clsComputers):
    lReturn = 
WNetOpenEnum(RESOURCE_GLOBALNET, 
RESOURCETYPE_DISK, 0, tNetRes, 
lEnumHwnd)
    If lReturn <> 0 
Then
        '// Raise error
Err.Raise 7773, , "Could not enumerate 
computers in domain!"
        Exit 
Sub
    End If
If you comment out 
the Err.Raise and Exit Sub lines, it 
goes on without the error, although I 
doubt if it will function correctly, 
just try!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/13/2001 12:28:54 AM:AGP
Plasma..I cant release the source code 
right now as some of it is proprietary. 
However if youre looking for a specific 
function I might be able to tell you 
where i found it on PlanetSourceCode. 
...
Mark from PowerSoft, my program 
sometimes errors out to when trying to 
enumarate computers in a doamin. It 
seems that some domains have problems 
opening even when you go to Network 
Neighborhood and try to open them 
manually. Trying to open the domains 
through code has problems too. Another 
program that does network searches like 
mine bombs on the same domain so i dont 
think its the code but rather how the 
network itself is setup. If you want to 
talk about it further we can chat 
offline or continue here for the 
benefit of other coders.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/13/2001 3:25:42 AM:Powersoft Programming
I think that's the problem too, I 
started this test again when the other 
PC was changing OS (multi-boot), thus 
the computers in the domain (workgroup 
to be specific, using Win98) changed 
and Windows had to re-initialize it. It 
took about 15 seconds before the form 
appeared, so that has definitely 
something to do with your 
network.
AGP, I don't think this 
discussion will last very long: it's 
just a network problem........ :-)
I 
think the only solution to this problem 
would be to either try to retrieve 
computers from a domain like 5 or 10 
times and then stop trying, or don't 
try at all and just wait until 
something causes it to refresh (the 
user or a timer or something).
Btw, 
my email is changing from the one shown 
on PSC to: 
webmaster@psprogramming.virtualave.net 
(website also changes to: 
http://psprogramming.virtualave.net), 
didn't have time to update it yet, but 
going to very soon.....
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/13/2001 12:50:06 PM:AGP
Yeah, I agree with you. If something in 
the network changes then the OS 
sometimes takes a while to refresh the 
domains and computers. Although, 
sometimes at my work LAN there seems to 
be a 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/13/2001 12:54:07 PM:El Mariachi
(hmm.my message was cut off...)
... 
"bad" node. Even when i go to Net 
Neighborhood and try to open the node 
manually there is a windows error. 
However this node is ALWAYS there. i 
havent narrowed down why its there nad 
why its "bad". my program craps out 
when the file search gets to this 
node.
My program also enumerates the 
domains on the fly only when a user 
clicks on search or when the user 
wishes to change the starting node of 
the search.
Anyway, just by browsing 
thru your code it seems that u do the 
same stuff as my current code. anyway 
ill test your classes for efficiency 
and let u know what happens.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/14/2001 2:01:55 PM:AGP
Mark, from doing some testing i found a 
bug in both your code as well as mine. 
The enumerator craps out when a 
computer with the same name apperas in 
different services. For example, if i 
put a debug statement at
        For 
lX = 1 To cComputers.GetCount
   Debug.Print cDomains.GetItem(lK) & " 
" & cComputers.GetItem(lX)
tvLAN.Nodes.Add cDomains.GetItem(lK), 
tvwChild, cComputers.GetItem(lX), 
cComputers.GetItem(lX), 3
        Next 
lX on my work LAN
then the code craps 
out if my LAN is setup up as 
follows:
Novell Directory Services 
0000E6U1
Novell Directory Services 
VPN_TEST
Novell Directory Services 
WELA
Novell Directory Services 
YEARK
NetWare Servers 0000E6U1
The 
error is #35602. I remember a long time 
ago getting this error but i never 
fixed it. Any suggestions??
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/14/2001 2:32:54 PM:AGP
Another thing I found Mark is that it 
seems like your code somehow skips 
domains in the root of Network 
Neighborhood. I ran your code and my 
code side-by-side on my work LAN and 
the domains in the root dont show up in 
your code. I have a pic but i dont know 
where to put it so ill just email it to 
you.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/24/2001 6:54:45 PM:SJW
It seems to work on Windows ME as well.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/4/2001 12:21:50 AM:carreraj
I got a run-time error 35602
Key is 
not unique in collection
this part 
of code ...
	For lX = 1 To 
cComputers.GetCount
tvLAN.Nodes.Add cDomains.GetItem(lK), 
tvwChild, cComputers.GetItem(lX), 
cComputers.GetItem(lX), 3
        Next 
lX
what can i do to make your code 
work?
e-mail me 
at
carreraj@netscape.net
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/4/2001 2:55:18 AM:Powersoft Programming
I know that bug is in the code, it's 
probably because you have 2 computers 
with the same name in 2 different 
domains.
The solution: download my 
update to this code, which solves the 
treeview problem and adds enumeration 
of shares resources for computers.
I 
got an error when trying to upload the 
update to PSC (some ASP error), if you 
still want the update before I am able 
to upload it here, mail me at 
webmaster@psprogramming.virtualave.net 
(the code can soon be found on my site 
too).
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/22/2001 12:41:14 PM:GPL
Hey AGP, just make sure the code you 
used from PSC wasnt GPLed, else you'd 
be forced to reveal all of your source.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/23/2001 1:59:17 AM:AnDy2552
Try reducing the TTL for faster 
response. On the other hand, you won't 
get a complete list.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/25/2001 6:53:25 PM:emj
cant run it in Windows NT (2000). Same 
error shows as with user of Windows NT 
4.0... Comment out the err.raise line 
wont solve the problem instead will 
hang. This wont work with Windows NT. 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/25/2001 6:54:35 PM:christian
got same error with problems on win nt 
4.0. im using win 2000 nt. commenting 
err.raise line wont solve the problem. 
it will cause the code to hang.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/26/2001 3:16:53 AM:Guus
Have been looking for such 
functionality for so long. Hope it 
works. If so, five stars for u!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/27/2001 10:50:24 AM:huntm
This doesn't work on WinNT2k, but it 
was a good effort from what i see!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/27/2001 5:01:06 AM:Andrew Webb
This is great, I'm using it under NT4 
and the computers in the domain list 
fine (although I only use the Computer 
class. Is there a way to list the 
computers that would normally be grayed 
out in server manager as well as the 
'live' ones ?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/27/2001 5:01:53 AM:Andrew Webb
This works great under NT4 using the 
computers class. Is there a way to get 
it to list the computers which would 
normally be grayed out in server 
manager, not just the 'live' ones ?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/20/2001 5:32:16 PM:Todd
Ok.. lets see if you can answer this 
tricky one..  do you know how to list 
the computers that are hidden from the 
network browser?  I can use NetUserEnum 
(which enumerates the workstation 
accounts from the SAM database) to get 
a list of every possible computer name. 
 This is a problem because it can be 
slow.  Any ideas?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/18/2001 10:10:57 PM:karim
First
I got this error when I run 
it.
Runtime error 7773 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/18/2001 10:20:38 PM:karim
I got this error when I run 
it.
Runtime error 7773 
"Could not 
enumerate computers in domain!
after 
that accroding Your reason i comment 
the That two lines and i run the 
program.
but now sytem is  
hanging
BTW, 
I'm using windows 
server 2000.
How can I 
execute this 
properly?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/19/2001 3:06:02 AM:Mark van Renswoude
I stopped using VB, switched to Delphi, 
so I'm not able to update this code. If 
there's anyone out there that knows how 
to correct this code so it works in all 
cases, you are free to take this code 
and upload the improved version. All 
that I'm asking for is a little credit 
for the original code.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/31/2001 2:36:36 PM:Chris
Here's what I figured out. This code 
has problems with Win2k (and 
subsequently, WinXP) because the 
Refresh sub checks the stuff it grabs 
from 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/27/2002 12:24:10 AM:Jamie Lindgren
Yep... I got WinXP and it doesn't work 
-_-
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | RentACoder Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.