Solved

Short Q on Computer names

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

803 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