I managed to query the httpd.exe service using WMI to check whether it is running or stopped. Here is the code that I am playing with:
hres = pSvc->ExecQuery(
bstr_t("WQL"),
bstr_t("SELECT * FROM Win32_Process Where Name='httpd.exe'"),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator);
Now I would like to query the amount of CPU that the service is using. I want to know whether the running service is doing work or not. Can this be done? Am I asking the right question? need advice :)