Results 1 to 22 of 22

Thread: Need help with Network Browsing [RESOLVED]

  1. #1

    Thread Starter
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840

    Question Need help with Network Browsing [RESOLVED]

    Hi.

    Does anyone have an example of enumerating available domains and workgroups?

    I need to make a dirtree like the one in explorer, but I can't figure out how to do the Networkplaces node.

    I have been looking at DirectoryServices but I have not been able to make it work.

    This only have to work in 2000 and XP so I don't mind using Management and WMI and the likes.
    Attached Images Attached Images  
    Last edited by pax; Feb 25th, 2004 at 07:46 AM.
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

  3. #3

    Thread Starter
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi Pirate.

    Thank's for your quick reply.

    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...

    ...Currently using VS2013...

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Umm don't know if it shows workgroups . For C# syntax , don't worry , just ask here and you'll find someone would help .

  5. #5

    Thread Starter
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi Pirate.

    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...

    ...Currently using VS2013...

  6. #6

  7. #7

    Thread Starter
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi Pirate.

    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...

    ...Currently using VS2013...

  8. #8
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Thanks , that's nice to hear

    For the errors , the first step is to do this before using any API in C# :
    PHP Code:
    using System.Runtime.InteropServices
    If this doesn't fix the errors , then post error messages and we'll try to fix them .

  9. #9

    Thread Starter
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840

    Yahoo....

    Hi Pirate.

    It's working now. I finally managed to convert the code to VB and find out how it was working.

    It needs a little finetuning to fit my purpose, but I don't think there will be any problems with that.

    Thanks again for all your help.
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  10. #10
    Registered User
    Join Date
    Jul 2001
    Posts
    283
    pax-
    can you post your vb code here when it works?
    enumerating through workgroups...

  11. #11

    Thread Starter
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi Marvin.

    Sure. I plan to make a few functions out of it, to make it easier to work with. When that is done I will post it along with a small sample.

    I don't have much time to work on it though, so please be patient...
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  12. #12
    Registered User
    Join Date
    Jul 2001
    Posts
    283
    thanks pax. i'm looking forward to it.

  13. #13

    Thread Starter
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi.

    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.
    Attached Files Attached Files
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  14. #14
    Registered User
    Join Date
    Jul 2001
    Posts
    283
    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.

  15. #15

    Thread Starter
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi Marvin

    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...

    ...Currently using VS2013...

  16. #16

    Thread Starter
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi.

    Here's a new version.

    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???
    Attached Files Attached Files
    Last edited by pax; Feb 26th, 2004 at 02:44 PM.
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  17. #17
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Sorry guys if that didn't help but I don't have Network Environment to test the code .

  18. #18

    Thread Starter
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    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...

    ...Currently using VS2013...

  19. #19
    Registered User
    Join Date
    Jul 2001
    Posts
    283
    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...

  20. #20
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    May I suggest something?...Could you post your project in the "codebank" forum? That's where a lot of people go to find snippets and such.

    And yes...Pirate IS the man!! He's a very patient and mature, and knowledgable(sp?) individual.

  21. #21

    Thread Starter
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi Marvin.

    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...

    ...Currently using VS2013...

  22. #22
    Addicted Member
    Join Date
    May 2006
    Posts
    142

    Re: Need help with Network Browsing [RESOLVED]

    hey can anyone tell me why is it that "who is the parent?" not working?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width