IEnumWbemClassObject* pEnumerator = NULL; hres = pSvc->ExecQuery( bstr_t("WQL"), bstr_t("Select * from Win32_Process"), WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator);
I want to get the process id for just the explorer process but I can not get the string comparison to work.
I have tried the following:
VARIANT vtProp; hr = pclsObj->Get(L"Name", 0, &vtProp, 0, 0); string procToFind = "explorer.exe"; string currentProc = (char *)vtProp.bstrVal; wcout << vtProp.bstrVal << " = " << procToFind.c_str() << " " << procToFind.compare(currentProc) << endl;
Why are these two not equal? I am new to C and am confused by all the different types of strings.
The only modification is the query I ran. Thanks for your help