Event Notification Using WMI

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
[1429 byte] By [abhiramsss] at [2007-11-19 18:42:42]
# 1 Re: Event Notification Using WMI
I am having the same problem, did you get the solution for these, if yes please mail to amitshinde80@yahoo.com

Thanks in advance
amitshinde at 2007-11-10 3:39:35 >
# 2 Re: Event Notification Using WMI
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.
PeejAvery at 2007-11-10 3:40:35 >