The only other thing I could think of is an ARP broadcast, but again, you
will only get computers that are powered on and are connected via TCP/IP.
The best thing about DNS and WINS is it is cached so you would get machines
that have are off as well, unless they've been off a long time :) But they
do need to be configured so it may not be a viable solution either. If you
are steadfast in your desire to use APIs, I think your only other option
would be to use winsock. Loop through all the IPs in the subnet and call
gethostbyaddr for each one. This would be a lengthy process though and not
very efficient. Again, only machines that are connected will respond. To
use winsock, #include <winsock2.h> and link to ws2_32.lib.
--
Frank
Post by Konrad "Carolus" BillewiczPost by Frank HickmanDid you add the netapi32.lib to your projects linker settings? But this
still will not work on Win9x. You might try using WNetOpenEnum however,
this will only browse available resources so computers that are off or do
not have any shares may not show up. I suspect what you really want is to
query the domain's DNS or WINS server?
Yep, you are right, at previous case I hadn't included the lib... You are
also right that functions WNetOpenEnum() and WNetEnumResource() are only
showing comps which are sharing something, so they are useless.
Hmm... I dont know much about Windows networking so It's dificult to say if
I want to query DNS or WINS server. :-) So far I'm looking for API function
without thinking how it's working. :-) If I had to do it on my own, propably
I would use some broadcast mechanism.
But... API function would be better. :-) Have you any other idea which would
be suffcient?
Best regards.