SOL9 Sample: SWbemServiceQueryApplet

SOL9 2.0 Samples

1 Screenshot


2 Source code

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



#include <sol/wmi/SWbemQueryApplet.h>


namespace SOL {

/**
 * Thread of ServiceStatus 
 */
class SWbemServiceQueryApplet: public SWbemQueryApplet {

public:  
  /**
   * Constructor
   */
  SWbemServiceQueryApplet()
  {
  
  }

public:
  virtual void display(SWbemObjectSet& objectSet)
  {
      long count = objectSet.getCount();

      for (long i = 0; i<count; i++) {
        try {
          SWbemObject object = objectSet.itemIndex(i);
          _bstr_t text = object.getObjectText(0);
          printf("\n\nService No:%d %S\n", i, (const wchar_t*)text);
          
        } catch (...) {

        }   
      }
  }

};

}


void _tmain(int argc, const TCHAR ** argv)
{

  try {
    Locale locale;
    SWbemServiceQueryApplet applet;

    
    //Start the thread of ServiceQuery
    applet.start();

    applet.wait();

  } catch (...) {

  }
}


Last modified: 2 May 2016

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