Click to See Complete Forum and Search --> : Event Notification Using WMI


abhiramsss
February 17th, 2006, 07:27 AM
hi all

iam working on WMI . iam trying to write an application for Event notification.

Iam usimg Win32_Process class, and ExecNotificationQuery for WQl query.

Iam trying to display a message when a new process is created.


my WQL query is

hres = pSvc->ExecNotificationQuery(
bstr_t("WQL"),
bstr_t("SELECT * FROM __InstanceCreationEvent WITHIN 5 WHERE TargetInstance ISA 'Win32_Process' And (TargetInstance.Name = 'notepad.exe' OR TargetInstance.Name = 'calc.exe' ) "),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator);


if iam not wrong ,After executing this query TargetInstance will be Instance of WIn32_process class.


and now iam trying extract data usoing this statement

hr = pclsObj->Get(L("TargetInstance.Name"), 0, &vtProp, 0, 0);

but iam not able to get value of Name property of Win32_Process class into vtProp where vtProp is of type VARIANT.

IWbemClassObject->Get( LPCWSTR wszName,LONG lFlags, VARIANT* pVal,CIMTYPE* pvtType, LONG* plFlavor) is used to retrieves Specified property value.

but here iam using it for getting value fron an istance i.e TargetInstance.Name. Is it the correct way to do if not please help me in extracting value of Name Property.

Please help me in solving this .

Thanks in advance

amitshinde
March 22nd, 2007, 09:55 AM
I am having the same problem, did you get the solution for these, if yes please mail to amitshinde80@yahoo.com

Thanks in advance

PeejAvery
March 22nd, 2007, 10:43 AM
Welcome to the forums, amitshinde. When you have a question, please post a new thread unless it has been answered elsewhere. We don't try to e-mail solutions, but rather post them once they are found. This allows all to benefit from the knowledge gained.

markiz
March 16th, 2008, 05:10 PM
I have similar problem.
If anyone found an answer please reply.

PeejAvery
March 17th, 2008, 10:34 PM
Markiz, please create a new thread when you have questions. Don't just post over someone else's thread (Which, by the way, is a year old).

In fact, I would suggest creating a new thread with this problem. Then explain your own problem specifically. Thank you.