
Originally Posted by
high_flyer
1. Poting on the wrong thread (just bacuse your problem has to do with WMI doesn't mean any other thread that has to do with it it a proper place for it).
2. Do some research you self, and tell us the resutls for exmple:
OR
Or any other stuff you actually tried to solve YOUR problem - before just laying it for us to do for you!
I don't think so. This thread is: How to use WMI, I shown what I did to solve it. I just forgot to mention this part:
#ifndef WIN32
#include <QProcess>
#endif
#include <ctype.h>
#include <algorithm>
#include <QMessageBox>
#include <QList>
#include <QByteArray>
#include <QVariant>
#ifdef WIN32
#endif
DMI::DMI(void)
{
}
void DMI::Initialize(void)
{
#ifdef WIN32
CoInitialize(0);
//get the locator object
objIWbemLocator
= new QAxObject("WbemScripting.SWbemLocator");
//get the main WMI Service
objWMIService
= objIWbemLocator
->querySubObject
("ConnectServer(QString&,QString&)",
QString("."),
QString("root\\cimv2"));
#endif
}
#ifndef WIN32
#include <QProcess>
#endif
#include <ctype.h>
#include <algorithm>
#include <QMessageBox>
#include <QList>
#include <QByteArray>
#include <QVariant>
#ifdef WIN32
QAxObject *DMI::objIWbemLocator;
QAxObject *DMI::objWMIService;
#endif
DMI::DMI(void)
{
}
void DMI::Initialize(void)
{
#ifdef WIN32
CoInitialize(0);
//get the locator object
objIWbemLocator = new QAxObject("WbemScripting.SWbemLocator");
//get the main WMI Service
objWMIService = objIWbemLocator->querySubObject("ConnectServer(QString&,QString&)",QString("."),QString("root\\cimv2"));
#endif
}
To copy to clipboard, switch view to plain text mode
That it's all what you need to do to communicate by WMI with Windows on Qt.
I don't give more details because this code worked in Qt 4.6.3 and stops to work in Qt 4.7.2 without any apparently error.
I said what I did, on commented code. All worked perfectly but the properties have no Value. I really don't know what I can do or which Qt 4.7.2 change affect the properly behavior of QAxObject.
QAxObject *bla = new QAxObject((IUnknown *)theItem.punkVal);
To copy to clipboard, switch view to plain text mode
bye and sorry.
Bookmarks