msxml3: Added checks for invalid arguments in queryresult.
[wine/hacks.git] / programs / taskmgr / optnmenu.c
blob81936dcac57c9555aec17e4fe598ec7180b65d1a
1 /*
2 * ReactOS Task Manager
4 * optnmenu.c
6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 * options.c
26 * Menu item handlers for the options menu.
29 #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
30 #include <windows.h>
31 #include <commctrl.h>
32 #include <stdlib.h>
33 #include <malloc.h>
34 #include <memory.h>
35 #include <tchar.h>
36 #include <stdio.h>
38 #include "taskmgr.h"
40 void TaskManager_OnOptionsAlwaysOnTop(void)
42 HMENU hMenu;
43 HMENU hOptionsMenu;
45 hMenu = GetMenu(hMainWnd);
46 hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
49 * Check or uncheck the always on top menu item
50 * and update main window.
52 if ((GetWindowLong(hMainWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0)
54 CheckMenuItem(hOptionsMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND|MF_UNCHECKED);
55 TaskManagerSettings.AlwaysOnTop = FALSE;
56 SetWindowPos(hMainWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
58 else
60 CheckMenuItem(hOptionsMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND|MF_CHECKED);
61 TaskManagerSettings.AlwaysOnTop = TRUE;
62 SetWindowPos(hMainWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
66 void TaskManager_OnOptionsMinimizeOnUse(void)
68 HMENU hMenu;
69 HMENU hOptionsMenu;
71 hMenu = GetMenu(hMainWnd);
72 hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
75 * Check or uncheck the minimize on use menu item.
77 if (GetMenuState(hOptionsMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND) & MF_CHECKED)
79 CheckMenuItem(hOptionsMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_UNCHECKED);
80 TaskManagerSettings.MinimizeOnUse = FALSE;
82 else
84 CheckMenuItem(hOptionsMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_CHECKED);
85 TaskManagerSettings.MinimizeOnUse = TRUE;
89 void TaskManager_OnOptionsHideWhenMinimized(void)
91 HMENU hMenu;
92 HMENU hOptionsMenu;
94 hMenu = GetMenu(hMainWnd);
95 hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
98 * Check or uncheck the hide when minimized menu item.
100 if (GetMenuState(hOptionsMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND) & MF_CHECKED)
102 CheckMenuItem(hOptionsMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_UNCHECKED);
103 TaskManagerSettings.HideWhenMinimized = FALSE;
105 else
107 CheckMenuItem(hOptionsMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_CHECKED);
108 TaskManagerSettings.HideWhenMinimized = TRUE;
112 void TaskManager_OnOptionsShow16BitTasks(void)
114 HMENU hMenu;
115 HMENU hOptionsMenu;
117 hMenu = GetMenu(hMainWnd);
118 hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
121 * FIXME: Currently this is useless because the
122 * current implementation doesn't list the 16-bit
123 * processes. I believe that would require querying
124 * each ntvdm.exe process for it's children.
128 * Check or uncheck the show 16-bit tasks menu item
130 if (GetMenuState(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND) & MF_CHECKED)
132 CheckMenuItem(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_UNCHECKED);
133 TaskManagerSettings.Show16BitTasks = FALSE;
135 else
137 CheckMenuItem(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_CHECKED);
138 TaskManagerSettings.Show16BitTasks = TRUE;
142 * Refresh the list of processes.
144 RefreshProcessPage();