>I am trying to implement SWbemObjectSet to find out if my EXE process is running.
>I am using two kinds of SELECT statements:
>loProcesses = loCIMV2.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'exename'")
>loProcesses = loCIMV2.ExecQuery("SELECT * FROM Win32_Process WHERE Name like 'exename%'")
>Both work fine on my XP development box (or so I think), but second statement gives me this:
>OLE IDispatch exception code 0 from SWbemObjectSet: Unspecified error
>on Win2000 box. Any idea?
>
>Thanks
Check
http://www.berezniker.com/display/VFP/Windows+Service+Status and
loCIMV2 = GetObject("winmgmts://localhost/root/cimv2")
loProcesses = loCimv2.ExecQuery("SELECT * FROM Win32_Process WHERE Name LIKE 'vfp%'")
For Each objProcess in loProcesses
objProcess.Terminate(0)
Next
Works here for me on Windows XP. Not everything is supported on Windows 2000.
If it's not broken, fix it until it is.
My Blog