0

I am very new to Windows Programming. Here Goes My code

objIWbemLocator = new QAxObject("WbemScripting.SWbemLocator");
objWMIService = objIWbemLocator->querySubObject("ConnectServer(QString&,QString&)",QString("."),QString("root\\cimv2"));

QAxObject* returnList = objWMIService->querySubObject("ExecQuery(QString&)", QString("select * from %1").arg(domain));
QAxObject* result = returnList->querySubObject("ItemIndex(int)", 0);

I am getting the Error on Runtime

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in

But ItemIndex Method Exists

Neel Basu
  • 12,638
  • 12
  • 82
  • 146

1 Answers1

1

MSDN says that

The ItemIndex method does not work with collections which do not contain SWbemObjects, such as SWbemMethodSet, SWbemNamedValueSet, SWbemPrivilegeSet, SWbemPropertySet, and SWbemQualifierSet.

What are you selecting ? Have you tried iterating over the collection ? Plus you need minimum Windows Vista for ItemIndex method. I hope this helps

O.C.
  • 6,711
  • 1
  • 25
  • 26
  • Well How to iterate over the collection ? Can you show Me some example ? I saw no *Iterator Class on that Documentation can you point me to some example ? – Neel Basu May 26 '11 at 11:01
  • 1
    See this link http://www.qtforum.org/article/31970/how-do-i-get-use-the-ienumerable-interface-in-qt.html. If you get it working please post your code too so that we all can benefit from your experience. Thanks – O.C. May 26 '11 at 11:09