6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
7 * 2005 Klemens Friedl <frik85@reactos.at>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 void DoSetPriority(DWORD priority
)
33 dwProcessId
= GetSelectedProcessId();
38 LoadStringW(hInst
, IDS_MSG_TASKMGRWARNING
, szTitle
, 256);
39 LoadStringW(hInst
, IDS_MSG_WARNINGCHANGEPRIORITY
, szText
, 260);
40 if (MessageBoxW(hMainWnd
, szText
, szTitle
, MB_YESNO
|MB_ICONWARNING
) != IDYES
)
43 hProcess
= OpenProcess(PROCESS_SET_INFORMATION
, FALSE
, dwProcessId
);
47 GetLastErrorText(szText
, 260);
48 LoadStringW(hInst
, IDS_MSG_UNABLECHANGEPRIORITY
, szTitle
, 256);
49 MessageBoxW(hMainWnd
, szText
, szTitle
, MB_OK
|MB_ICONSTOP
);
53 if (!SetPriorityClass(hProcess
, priority
))
55 GetLastErrorText(szText
, 260);
56 LoadStringW(hInst
, IDS_MSG_UNABLECHANGEPRIORITY
, szTitle
, 256);
57 MessageBoxW(hMainWnd
, szText
, szTitle
, MB_OK
|MB_ICONSTOP
);
60 CloseHandle(hProcess
);