I want to do something with WMI (receiving event notification), so I start with a simple example from the MSDN website:
Receive event notifications through WMI
this program receives an event notification (process creation) through WMI and calls the EventSink :: Indicate function after receiving the event.
I used the same code in the link above (copy / past) with one change: in the EventSink class, the function
HRESULT EventSink::Indicate(long lObjectCount, IWbemClassObject **apObjArray)
I added a few lines to get the property of the object (the object is returned in apObjArray):
for (int i = 0; i < lObjectCount; i++)
{
VARIANT varName;
hres = apObjArray[i]->Get(_bstr_t(L"Name"),
0, &varName, 0, 0);
}
now the Get (...) functions return WBEM_E_NOT_FOUND (the specified property was not found) regardless of what I am looking for (I'm sure from the documentation that the properties are there ...)
Please let me know what I missed! any help is appreciated.