Confussion with Assigning an applications's process priority [modified]
-
After reading the article: Enumerating processes : A practical approach By Irfan Dawood. I found this really helpfull with what I have to do. However, I only have the name of the application (hello.exe). The
processInfo=new PROCESSENTRY32;
has a member variable: szExeFile which is a: "Pointer to a null-terminated string that specifies the name of the executable file for the process. " I figure after getting all the processes if I just search for my process using the name I can obtain the process ID of the "hello.exe" process therefore then be able to set the priority://Here we are trying to get all possible access. HANDLE hProcess=OpenProcess(PROCESS_ALL_ACCESS,TRUE,processID); if(hProcess==NULL) { cout<<"Unable to get handle of process: "< but whenever I try to do: `if( processInfo->szExeFile == _T("hello.exe"))` it doesn't work. and when I try to print out `cout<szExeFile;` I get "Name: 0036630C"... Am I completely off my rocker? Thanks, -- modified at 11:36 Thursday 24th August, 2006 -- modified at 11:44 Thursday 24th August, 2006 Kitty5
-
After reading the article: Enumerating processes : A practical approach By Irfan Dawood. I found this really helpfull with what I have to do. However, I only have the name of the application (hello.exe). The
processInfo=new PROCESSENTRY32;
has a member variable: szExeFile which is a: "Pointer to a null-terminated string that specifies the name of the executable file for the process. " I figure after getting all the processes if I just search for my process using the name I can obtain the process ID of the "hello.exe" process therefore then be able to set the priority://Here we are trying to get all possible access. HANDLE hProcess=OpenProcess(PROCESS_ALL_ACCESS,TRUE,processID); if(hProcess==NULL) { cout<<"Unable to get handle of process: "< but whenever I try to do: `if( processInfo->szExeFile == _T("hello.exe"))` it doesn't work. and when I try to print out `cout<szExeFile;` I get "Name: 0036630C"... Am I completely off my rocker? Thanks, -- modified at 11:36 Thursday 24th August, 2006 -- modified at 11:44 Thursday 24th August, 2006 Kitty5
kitty5 wrote:
but whenever I try to do: if( processInfo->szExeFile == _T("hello.exe")) it doesn't work. and when I try to print out cout<szExeFile; I get "Name: 0036630C"...
processInfo->szExeFile
is a pointer. When you try comparing it or print it you are really testing the address. You should de-reference it first ieif( *processInfo->szExeFile == _T("hello.exe"))
cout<szExeFile;