Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenpriority.c
Go to the documentation of this file.
00001 /* 00002 * ReactOS Task Manager 00003 * 00004 * priority.c 00005 * 00006 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org> 00007 * 2005 Klemens Friedl <frik85@reactos.at> 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2.1 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00022 */ 00023 00024 #include <precomp.h> 00025 00026 void DoSetPriority(DWORD priority) 00027 { 00028 DWORD dwProcessId; 00029 HANDLE hProcess; 00030 WCHAR szText[260]; 00031 WCHAR szTitle[256]; 00032 00033 dwProcessId = GetSelectedProcessId(); 00034 00035 if (dwProcessId == 0) 00036 return; 00037 00038 LoadStringW(hInst, IDS_MSG_TASKMGRWARNING, szTitle, 256); 00039 LoadStringW(hInst, IDS_MSG_WARNINGCHANGEPRIORITY, szText, 260); 00040 if (MessageBoxW(hMainWnd, szText, szTitle, MB_YESNO|MB_ICONWARNING) != IDYES) 00041 return; 00042 00043 hProcess = OpenProcess(PROCESS_SET_INFORMATION, FALSE, dwProcessId); 00044 00045 if (!hProcess) 00046 { 00047 GetLastErrorText(szText, 260); 00048 LoadStringW(hInst, IDS_MSG_UNABLECHANGEPRIORITY, szTitle, 256); 00049 MessageBoxW(hMainWnd, szText, szTitle, MB_OK|MB_ICONSTOP); 00050 return; 00051 } 00052 00053 if (!SetPriorityClass(hProcess, priority)) 00054 { 00055 GetLastErrorText(szText, 260); 00056 LoadStringW(hInst, IDS_MSG_UNABLECHANGEPRIORITY, szTitle, 256); 00057 MessageBoxW(hMainWnd, szText, szTitle, MB_OK|MB_ICONSTOP); 00058 } 00059 00060 CloseHandle(hProcess); 00061 } Generated on Mon May 28 2012 04:17:32 for ReactOS by
1.7.6.1
|