SOL9 Sample: NetSharingManager

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * NetSharingManager.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\NetSharingManager.h>

#include <sol\netmgr\NetSharingPublicConnectionCollection.h>
#include <sol\netmgr\NetSharingEveryConnectionCollection.h>
#include <sol\netmgr\NetSharingPrivateConnectionCollection.h>


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

  try {
    COMInitializer initializer;
    initializer.setDefaultSecurityLevels();

    SOL::NetSharingManager sharingManager;
    bool sharingInstalled = sharingManager.getSharingInstalled();
    _tprintf(_T("SharingInstalled = %d\n"), sharingInstalled);
      
    try {
      printf("Try to getEnumPublicConnections()\n");
      NetSharingPublicConnectionCollection collection = sharingManager.getEnumPublicConnections();
      collection.display();

    } catch (...) {
      printf("Failed to getEnumPublicConnections()\n");
    }

    try {
      printf("Try to getEnumEveryConnection()\n");
      NetSharingEveryConnectionCollection collection = sharingManager.getEnumEveryConnection();
      collection.display();

    } catch (...) {
      printf("Failed to getEnumEveryConnection()\n");
    }

    try {
      printf("Try to getEnumPrivateConnections()\n");
      NetSharingPrivateConnectionCollection collection = sharingManager.getEnumPrivateConnections();
      collection.display();

    } catch (...) {
      printf("Failed to getEnumPrivateConnections()\n");
    }

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

}



Last modified: 2 May 2016

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