Network Enumerations (3)

Having seen the 2 previous offerings which front load the enumeration in such a way that on a large or awkward network they can take a long time to return, I took a look at the browse for folder code which was rather cumbersome but with some tinkering reduced it to the following:


LPITEMIDLIST pidlRoot = NULL;
SHGetSpecialFolderLocation(GetSafeHwnd(), CSIDL_NETWORK, &pidlRoot);

CString strDisplayName;
BROWSEINFO bi;
memset(&bi, 0, sizeof(BROWSEINFO));
bi.hwndOwner = GetSafeHwnd();
bi.pidlRoot = pidlRoot;
bi.pszDisplayName = strDisplayName.GetBuffer(MAX_PATH + 1);
bi.lpszTitle = "Find computer";
bi.ulFlags = BIF_BROWSEFORCOMPUTER;

LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
strDisplayName.ReleaseBuffer();

if(pidl)
{
    m_machine = strDisplayName;
    UpdateData(FALSE);
}

IMalloc *pMalloc = NULL;
SHGetMalloc(&pMalloc);
pMalloc->Free(pidlRoot);


Create a dialog box with a CEdit control on it. Create a member variable for this CEdit called m_machine. Attach the code above to a button (any other than OK or Cancel).



Comments

  • Thanks for this code!!

    Posted by Legacy on 01/19/2004 12:00am

    Originally posted by: Don Fleming

    Works great.

    Reply
  • enum printer devices on the local network

    Posted by Legacy on 01/15/2003 12:00am

    Originally posted by: vikrant chaudhary

    i am building network print spooler. could u tell me how i
    can enumerate printer devices, connected with my local network. I'm working on windows 9x/nt with TCP/IP.

    Reply
  • help me please

    Posted by Legacy on 02/25/2002 12:00am

    Originally posted by: nagesh

    hi,

    Iam in need of you help in visual basic. I just want to know the concept or code involved in getting the information of all systems running in the network without running any client program on any network system.

    Also i want to know the concept in managing the ports ie(i want a code that can close or open the HTTP / ftp etc ports in the windows system....

    Reply
  • Network

    Posted by Legacy on 02/23/2002 12:00am

    Originally posted by: Marina

    Super, 10x!
    

    Reply
  • Thanks for that code!

    Posted by Legacy on 03/16/2001 12:00am

    Originally posted by: Peter Thoemmes

    Hi Sam,
    that was exactly what I was looking for!
    I found it a very good solution!
    Thanks for taking this code to the Web!

    Peter

    Reply
  • Question for you....

    Posted by Legacy on 02/20/2001 12:00am

    Originally posted by: Luis Enrique Juarez Solis

    Cuold you tell me please, how to do create a map drive???
    I was trying create with WNetAddConnection2, but I receive a 53 number and is not a specific error, I tried check the error name with WNetGetLastError function, but only gave me a NULL string... I tried too with Register, I can create the map, but when I try see the info appear a error message
    I don't know what to do... I will appreciate any help from you.

    Enrique.

    Reply
  • Network enumerations (3)

    Posted by Legacy on 09/12/2000 12:00am

    Originally posted by: Hermann Fischer

    Thank you ... very good

    Reply
  • How can i get the IP Address??

    Posted by Legacy on 07/24/2000 12:00am

    Originally posted by: Magnes

    I use this code in my program...
    but i want to know the ip address ...please tell me the way
    thanks...........^^

    Reply
  • How to enum all servers of the domain include not active servers

    Posted by Legacy on 04/20/2000 12:00am

    Originally posted by: Thomas Loesslein

    If I start the NT server manager I can see all servers and workstations that have an account in this domain. If I use enumservers I can only see the active machines. What to do to see all machines.

    Reply
  • THanks for your code, its exactly what i wanted

    Posted by Legacy on 03/16/2000 12:00am

    Originally posted by: OLivier Cheneson

    Hi Sam,


    THanks for the code.
    It is very clear and use the full functionality of SHBROWSEFORFOLDER function

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: November 20, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Are you wanting to target two or more platforms such as iOS, Android, and/or Windows? You are not alone. 90% of enterprises today are targeting two or more platforms. Attend this eSeminar to discover how mobile app developers can rely on one IDE to create applications across platforms and approaches (web, native, and/or hybrid), saving time, money, and effort and introducing apps to market faster. You'll learn the trade-offs for gaining long …

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds