I have code witch adds current working processes to combo box and I want to exclude all processes with name: svchost.exe
if (Process32First(hSnap, &proc))
{
pComboBox->AddString(proc.szExeFile);
while (Process32Next(hSnap, &proc)){
if (proc.szExeFile != L"svchost.exe")
pComboBox->AddString(proc.szExeFile);
}
}
I try that code but its not working at all.
How I can exclude all svchost.exe processes?
I think you cannot use:
Using below instead:
When comparing two literals, you cannot use the binary operator like
=, which will compare the address of the two literals, apparently they addresses will be different in most cases, in your case, literalL"svchost.exe"is stored in some static data section of the program which will not equal to process names stored locally in the stack.