SOL9 Sample: NetworkListManager

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * NetworkListManager.cpp 
 * Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


//2012/08/29

#include <sol\Locale.h>
#include <sol\COMInitializer.h>
#include <sol\netmgr\NetworkListManager.h>
#include <sol\netmgr\EnumNetworks.h>
#include <sol\netmgr\Network.h>


void _tmain(int argc, const TCHAR* argv[])
{
  Locale locale;

  try {
    COMInitializer initializer;

    SOL::NetworkListManager listManager;

    _tprintf(_T("\nConnected NetworkList\n"));
    EnumNetworks enumNetworks1 = listManager.getNetworks(NLM_ENUM_NETWORK_CONNECTED);
    bool looping = true;
    while(looping) {
      try {
        Network network = enumNetworks1.next();
        network.display();      
      } catch (HRESULT ) {
        break;
      }
    }

    _tprintf(_T("\nDisconnected NetworkList\n"));
    EnumNetworks enumNetworks2 = listManager.getNetworks(NLM_ENUM_NETWORK_DISCONNECTED);
    looping = true;
    while(looping) {
      try {
        Network network = enumNetworks2.next();
        network.display();      
      } catch (HRESULT ) {
        break;
      }
    }
    _tprintf(_T("\nAll NetworkList\n"));
    EnumNetworks enumNetworks3 = listManager.getNetworks(); //NLM_ENUM_NETWORK_ALL
    looping = true;
    while(looping) {
      try {
        Network network = enumNetworks3.next();
        network.display();      
      } catch (HRESULT ) {
        break;
      }
    }

  } catch (Exception& ex) {
    ex.printf();  
  } catch (HRESULT hr) {
    _tprintf(_T("Exception: HRESULT=%x\n"), hr);
  }

}



Last modified: 2 May 2016

Copyright (c) 2016 Antillia.com ALL RIGHTS RESERVED.