?
Solved

Short Q on Computer names

Posted on 2000-04-03
3
Medium Priority
?
225 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 80 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

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.
Suggested Courses

771 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