Solved

Short Q on Computer names

Posted on 2000-04-03
3
211 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

749 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