Unfortunatly, at the moment I don't have C#, and I only have Framework V1.0 so I can't test it here. I will test it later though to see if I can translate it to VB. (I'm not to big on C# though... )
Do you now if it will also enumerate workgroups as well?
I wish I could think of something witty to put in my sig...
I have just tried that example you refered to, and that is not exactly what I'm looking for. But thanks for the effort though.
In the mean time I have been fooling around with DirectoryServices and I managed to enum the domains and the workgroups. I could also enum the computers attached to the domains and workgroups. But I got stuck on how to get the shares from the computers that I found. Also, it returned a lot of computers that I couldn't see in the explorer. I can't figure out how the explorer filters what to show and what not to show.
Do you have any ideas on how to got on from here?
I wish I could think of something witty to put in my sig...
Well it looks promising, but I get some compile errors.
I have just copy/pasted it into a new class in a C# project, and it complains about functions not returning values and such.
I only have VS2002, so maybe it's for VS2003.
But I will still try to examine his code, and see if I can figure out his API calls.
I will post again later.
Thanks for all your help so far.
BTW. I see your name a lot around here. You seem to give a lot more answers than you ask questions. You must really enjoy helping others out! Well, just wanted to let you know that I really appreciate what you (and all the others who's names I see all the time...you know who you are... ) do around here.
I wish I could think of something witty to put in my sig...
I managed to get some free time this morning, so I have made a couple of functions that I think can be usefull.
You might have to tinker a bit to fit your needs, but this should get you well on your way.
Thank's to Pirate for this. I couldn't have done it without his help.
And thank's to Eugene Zhukovsky from PSC, who originally made the C# code that this is based on.
I wish I could think of something witty to put in my sig...
pax or pirate -
i ran the code you attached and all i get is a treeview with the three initial nodes. none of them have any subnodes when i try to expand them, though there are lots of workgroups on my network, which i can see in mycomputer.
does this code as pax gave it work straight up for anybody else? im using win xp pro.
You're right. I just tested this myself on Win XP Pro and there are only a couple of providers. Strange thing is that if I call the GetSubItems with the name of my workgroup it works.
Apperantly it's only the workgroups that it can't see.
I initially made this on a Win2000 pc and it worked like a charm.
I have no idea why it won't work on XP, but I will try to make a combo of these API's and DirectoryService, to see if that get's me anywhere.
Please let me know if you figure out what's wrong.
I will post back when I got some more news.
I wish I could think of something witty to put in my sig...
It's pretty much the same, except that it's filtered so only the "Microsoft Windows-network" will be returned, so I have no idea wether it will work with a Novell network.
You can easily change the filter yourself. It still gets all the providers, and then I do a For...Next loop to remove all that doesn't start with "Microsoft Windows"
The domains and workgroups are enumerated using DirectoryServices, and I only know how to do that using "WinNT:" as search path. That's why I restricted it to one provider.
The subitems and shares are still enumerated using the WNET api's, so it's only a small change.
I hope you can still use it. I know I can...
edit: BTW. this one has only been tested on Win XP Pro with 2 pc's on a network with one workgroup and no domain.
So if you can try it on a "real" network with both domains and several workgroups and tell me how it works, I'd be very happy.
Another edit : I just found this at MSDN. WNetEnumResource
In the bottom of the screen it says that it requires an NT-server or later. Perhaps that's why it didn't work when I only had 2 pc's on a share-based network???
Last edited by pax; Feb 26th, 2004 at 02:44 PM.
I wish I could think of something witty to put in my sig...
That's cool...I have just tested this myself on my work network, and it appears to work fine. So now I know it works both on a regular network and a small sharenetwork. Well, at least it works well enough for me.
I wish I could think of something witty to put in my sig...
it works fine for me too now.
does anybody know how to get the items from "my network places"? like mapped internet ftp servers or mapped network drives?
and maybe take resolved out of the thread title...
Now why would I remove the [RESOLVED] part?
It IS resolved...for me at least...finally
To stop this thread from growing out of proportion and loosing it's focus I would suggest starting a new thread for the mapped resources question.
Not that I'm not interrested in your question, far from it.
I'm also very interrested in hearing about it, but I think it qualifies as a new question
Also I think that very few people will actually notice the question when it's located some 20 post's down.
edit: thephantom: Great idea. I'll do that right away...
I wish I could think of something witty to put in my sig...