Solved

Short Q on Computer names

Posted on 2000-04-03
3
223 Views
Last Modified: 2010-04-02
Hi!

Is NetBIOS functions the easiest way to
get a list of all the Computer Names in the Windows Network?
Is there no "smart" functions like file-functions but for networks?

Thanks!
0
Comment
Question by:Scattan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 20 total points
ID: 2681228
If you're using NT, 'NetServerEnum()' will do the job (http://msdn.microsoft.com/library/psdk/network/ntlmapi2_1vl9.htm). On all other MS 'platforms', use 'WNetEnumResource()' (http://msdn.microsoft.com/library/psdk/network/networks_03ad.htm)
0
 

Author Comment

by:Scattan
ID: 2682899
Thank you!

It's a really good function, but I just get the first letter in each computer I find. You'll get some more points if you can help me in solving that.
I guess I need to allocate some more memory somehow to get the whole string, but I don't really see where. The helpfile tells me that if I use MAX_PREFERRED_LENGTH, (-1), "the function will allocate the amount of memory needed for the data."

What do I do wrong?

(I have followed the sample-code in the link you gave me, it's a bit different from my helpfile, I don't know which one that is the oldest. For example in my helpfile it sais that I should include lmserver.h, but that doesn't work, it works with lm.h, which I found in your helpfile)

Thanks!
0
 

Author Comment

by:Scattan
ID: 2683055
OK, now I gave myself a lesson in Unicode handling, so I know now what I did wrong.

Thanks for the tip!
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question