SetPriorityClass Problem
I'm trying to run a program in low priority mode, not my C++ program but some third-party programs like iTunes and etc.
Here's my sample code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
int main()
{
HWND hWnd = FindWindow(NULL, L"iTunes");
if (hWnd == 0)
{
cout << "Process not found!" << endl;
}
else
{
cout << "Process Found!" << endl;
DWORD pId;
GetWindowThreadProcessId(hWnd, &pId);
cout << "PID: " << pId << endl;
HANDLE hProcess = hWnd;
SetPriorityClass( hProcess ,BELOW_NORMAL_PRIORITY_CLASS);
}
cin.get();
return 0;
}
|
but the process is still at normal priority.
Topic archived. No new replies allowed.