I want to do something with WMI (receiving some event notification) so I start with simple example from MSDN website:
Receiving Event Notifications Through WMI
this program receives an event notification (process creation) through WMI, and calls the function EventSink::Indicate upon receiving the event.
I used the same code in the link above (copy/past) with one change: in the class EventSink, the function
HRESULT EventSink::Indicate(long lObjectCount, IWbemClassObject **apObjArray)
I added few lines to retrieve a 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 returns WBEM_E_NOT_FOUND (The specified property is not found) no matter what I look for (am sure from the documentation that the properties are there...)
please let me know what have I missed ?! any help is appreciated.