dmsynth: Implement IDirectMusicSynth_(Download|Unload) for waves.
[wine.git] / programs / taskmgr / column.c
blob3dc0e6845b8e51b68f89080de1053b616c851879
1 /*
2 * ReactOS Task Manager
4 * column.c
6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
7 * Copyright (C) 2008 Vladimir Pankratov
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 St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include <stdio.h>
25 #include <stdlib.h>
27 #include <windows.h>
28 #include <commctrl.h>
30 #include "taskmgr.h"
31 #include "column.h"
33 UINT ColumnDataHints[25];
35 /* Column Headers; Begin */
36 static WCHAR wszImageName[255];
37 static WCHAR wszPID[255];
38 static WCHAR wszUserName[255];
39 static WCHAR wszSessionID[255];
40 static WCHAR wszCPU[255];
41 static WCHAR wszCPUTime[255];
42 static WCHAR wszMemUsage[255];
43 static WCHAR wszPeakMemUsage[255];
44 static WCHAR wszMemDelta[255];
45 static WCHAR wszPageFaults[255];
46 static WCHAR wszPFDelta[255];
47 static WCHAR wszVMSize[255];
48 static WCHAR wszPagedPool[255];
49 static WCHAR wszNPPool[255];
50 static WCHAR wszBasePri[255];
51 static WCHAR wszHandles[255];
52 static WCHAR wszThreads[255];
53 static WCHAR wszUSERObjects[255];
54 static WCHAR wszGDIObjects[255];
55 static WCHAR wszIOReads[255];
56 static WCHAR wszIOWrites[255];
57 static WCHAR wszIOOther[255];
58 static WCHAR wszIOReadBytes[255];
59 static WCHAR wszIOWriteBytes[255];
60 static WCHAR wszIOOtherBytes[255];
61 /* Column Headers; End */
63 static void load_column_headers(void)
65 LoadStringW(hInst, IDS_IMAGENAME, wszImageName, ARRAY_SIZE(wszImageName));
66 LoadStringW(hInst, IDS_PID, wszPID, ARRAY_SIZE(wszPID));
67 LoadStringW(hInst, IDS_USERNAME, wszUserName, ARRAY_SIZE(wszUserName));
68 LoadStringW(hInst, IDS_SESSIONID, wszSessionID, ARRAY_SIZE(wszSessionID));
69 LoadStringW(hInst, IDS_CPUUSAGE, wszCPU, ARRAY_SIZE(wszCPU));
70 LoadStringW(hInst, IDS_CPUTIME, wszCPUTime, ARRAY_SIZE(wszCPUTime));
71 LoadStringW(hInst, IDS_MEMORYUSAGE, wszMemUsage, ARRAY_SIZE(wszMemUsage));
72 LoadStringW(hInst, IDS_PEAKMEMORYUSAGE, wszPeakMemUsage, ARRAY_SIZE(wszPeakMemUsage));
73 LoadStringW(hInst, IDS_MEMORYUSAGEDELTA, wszMemDelta, ARRAY_SIZE(wszMemDelta));
74 LoadStringW(hInst, IDS_PAGEFAULTS, wszPageFaults, ARRAY_SIZE(wszPageFaults));
75 LoadStringW(hInst, IDS_PAGEFAULTSDELTA, wszPFDelta, ARRAY_SIZE(wszPFDelta));
76 LoadStringW(hInst, IDS_VIRTUALMEMORYSIZE, wszVMSize, ARRAY_SIZE(wszVMSize));
77 LoadStringW(hInst, IDS_PAGEDPOOL, wszPagedPool, ARRAY_SIZE(wszPagedPool));
78 LoadStringW(hInst, IDS_NONPAGEDPOOL, wszNPPool, ARRAY_SIZE(wszNPPool));
79 LoadStringW(hInst, IDS_BASEPRIORITY, wszBasePri, ARRAY_SIZE(wszBasePri));
80 LoadStringW(hInst, IDS_HANDLECOUNT, wszHandles, ARRAY_SIZE(wszHandles));
81 LoadStringW(hInst, IDS_THREADCOUNT, wszThreads, ARRAY_SIZE(wszThreads));
82 LoadStringW(hInst, IDS_USEROBJECTS, wszUSERObjects, ARRAY_SIZE(wszUSERObjects));
83 LoadStringW(hInst, IDS_GDIOBJECTS, wszGDIObjects, ARRAY_SIZE(wszGDIObjects));
84 LoadStringW(hInst, IDS_IOREADS, wszIOReads, ARRAY_SIZE(wszIOReads));
85 LoadStringW(hInst, IDS_IOWRITES, wszIOWrites, ARRAY_SIZE(wszIOWrites));
86 LoadStringW(hInst, IDS_IOOTHER, wszIOOther, ARRAY_SIZE(wszIOOther));
87 LoadStringW(hInst, IDS_IOREADBYTES, wszIOReadBytes, ARRAY_SIZE(wszIOReadBytes));
88 LoadStringW(hInst, IDS_IOWRITEBYTES, wszIOWriteBytes, ARRAY_SIZE(wszIOWriteBytes));
89 LoadStringW(hInst, IDS_IOOTHERBYTES, wszIOOtherBytes, ARRAY_SIZE(wszIOOtherBytes));
92 static int InsertColumn(int nCol, LPCWSTR lpszColumnHeading, int nFormat, int nWidth, int nSubItem)
94 LVCOLUMNW column;
96 column.mask = LVCF_TEXT|LVCF_FMT;
97 column.pszText = (LPWSTR)lpszColumnHeading;
98 column.fmt = nFormat;
100 if (nWidth != -1)
102 column.mask |= LVCF_WIDTH;
103 column.cx = nWidth;
106 if (nSubItem != -1)
108 column.mask |= LVCF_SUBITEM;
109 column.iSubItem = nSubItem;
112 return ListView_InsertColumnW(hProcessPageListCtrl, nCol, &column);
115 void AddColumns(void)
117 int size;
119 load_column_headers();
121 if (TaskManagerSettings.Column_ImageName)
122 InsertColumn(0, wszImageName, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[0], -1);
123 if (TaskManagerSettings.Column_PID)
124 InsertColumn(1, wszPID, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[1], -1);
125 if (TaskManagerSettings.Column_UserName)
126 InsertColumn(2, wszUserName, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[2], -1);
127 if (TaskManagerSettings.Column_SessionID)
128 InsertColumn(3, wszSessionID, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[3], -1);
129 if (TaskManagerSettings.Column_CPUUsage)
130 InsertColumn(4, wszCPU, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[4], -1);
131 if (TaskManagerSettings.Column_CPUTime)
132 InsertColumn(5, wszCPUTime, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[5], -1);
133 if (TaskManagerSettings.Column_MemoryUsage)
134 InsertColumn(6, wszMemUsage, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[6], -1);
135 if (TaskManagerSettings.Column_PeakMemoryUsage)
136 InsertColumn(7, wszPeakMemUsage, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[7], -1);
137 if (TaskManagerSettings.Column_MemoryUsageDelta)
138 InsertColumn(8, wszMemDelta, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[8], -1);
139 if (TaskManagerSettings.Column_PageFaults)
140 InsertColumn(9, wszPageFaults, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[9], -1);
141 if (TaskManagerSettings.Column_PageFaultsDelta)
142 InsertColumn(10, wszPFDelta, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[10], -1);
143 if (TaskManagerSettings.Column_VirtualMemorySize)
144 InsertColumn(11, wszVMSize, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[11], -1);
145 if (TaskManagerSettings.Column_PagedPool)
146 InsertColumn(12, wszPagedPool, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[12], -1);
147 if (TaskManagerSettings.Column_NonPagedPool)
148 InsertColumn(13, wszNPPool, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[13], -1);
149 if (TaskManagerSettings.Column_BasePriority)
150 InsertColumn(14, wszBasePri, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[14], -1);
151 if (TaskManagerSettings.Column_HandleCount)
152 InsertColumn(15, wszHandles, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[15], -1);
153 if (TaskManagerSettings.Column_ThreadCount)
154 InsertColumn(16, wszThreads, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[16], -1);
155 if (TaskManagerSettings.Column_USERObjects)
156 InsertColumn(17, wszUSERObjects, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[17], -1);
157 if (TaskManagerSettings.Column_GDIObjects)
158 InsertColumn(18, wszGDIObjects, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[18], -1);
159 if (TaskManagerSettings.Column_IOReads)
160 InsertColumn(19, wszIOReads, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[19], -1);
161 if (TaskManagerSettings.Column_IOWrites)
162 InsertColumn(20, wszIOWrites, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[20], -1);
163 if (TaskManagerSettings.Column_IOOther)
164 InsertColumn(21, wszIOOther, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[21], -1);
165 if (TaskManagerSettings.Column_IOReadBytes)
166 InsertColumn(22, wszIOReadBytes, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[22], -1);
167 if (TaskManagerSettings.Column_IOWriteBytes)
168 InsertColumn(23, wszIOWriteBytes, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[23], -1);
169 if (TaskManagerSettings.Column_IOOtherBytes)
170 InsertColumn(24, wszIOOtherBytes, LVCFMT_RIGHT, TaskManagerSettings.ColumnSizeArray[24], -1);
172 size = SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0);
173 SendMessageW(hProcessPageListCtrl, LVM_SETCOLUMNORDERARRAY, (WPARAM) size, (LPARAM) &TaskManagerSettings.ColumnOrderArray);
175 UpdateColumnDataHints();
178 static INT_PTR CALLBACK ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
181 switch (message)
183 case WM_INITDIALOG:
185 if (TaskManagerSettings.Column_ImageName)
186 SendMessageW(GetDlgItem(hDlg, IDC_IMAGENAME), BM_SETCHECK, BST_CHECKED, 0);
187 if (TaskManagerSettings.Column_PID)
188 SendMessageW(GetDlgItem(hDlg, IDC_PID), BM_SETCHECK, BST_CHECKED, 0);
189 if (TaskManagerSettings.Column_UserName)
190 SendMessageW(GetDlgItem(hDlg, IDC_USERNAME), BM_SETCHECK, BST_CHECKED, 0);
191 if (TaskManagerSettings.Column_SessionID)
192 SendMessageW(GetDlgItem(hDlg, IDC_SESSIONID), BM_SETCHECK, BST_CHECKED, 0);
193 if (TaskManagerSettings.Column_CPUUsage)
194 SendMessageW(GetDlgItem(hDlg, IDC_CPUUSAGE), BM_SETCHECK, BST_CHECKED, 0);
195 if (TaskManagerSettings.Column_CPUTime)
196 SendMessageW(GetDlgItem(hDlg, IDC_CPUTIME), BM_SETCHECK, BST_CHECKED, 0);
197 if (TaskManagerSettings.Column_MemoryUsage)
198 SendMessageW(GetDlgItem(hDlg, IDC_MEMORYUSAGE), BM_SETCHECK, BST_CHECKED, 0);
199 if (TaskManagerSettings.Column_PeakMemoryUsage)
200 SendMessageW(GetDlgItem(hDlg, IDC_PEAKMEMORYUSAGE), BM_SETCHECK, BST_CHECKED, 0);
201 if (TaskManagerSettings.Column_MemoryUsageDelta)
202 SendMessageW(GetDlgItem(hDlg, IDC_MEMORYUSAGEDELTA), BM_SETCHECK, BST_CHECKED, 0);
203 if (TaskManagerSettings.Column_PageFaults)
204 SendMessageW(GetDlgItem(hDlg, IDC_PAGEFAULTS), BM_SETCHECK, BST_CHECKED, 0);
205 if (TaskManagerSettings.Column_PageFaultsDelta)
206 SendMessageW(GetDlgItem(hDlg, IDC_PAGEFAULTSDELTA), BM_SETCHECK, BST_CHECKED, 0);
207 if (TaskManagerSettings.Column_VirtualMemorySize)
208 SendMessageW(GetDlgItem(hDlg, IDC_VIRTUALMEMORYSIZE), BM_SETCHECK, BST_CHECKED, 0);
209 if (TaskManagerSettings.Column_PagedPool)
210 SendMessageW(GetDlgItem(hDlg, IDC_PAGEDPOOL), BM_SETCHECK, BST_CHECKED, 0);
211 if (TaskManagerSettings.Column_NonPagedPool)
212 SendMessageW(GetDlgItem(hDlg, IDC_NONPAGEDPOOL), BM_SETCHECK, BST_CHECKED, 0);
213 if (TaskManagerSettings.Column_BasePriority)
214 SendMessageW(GetDlgItem(hDlg, IDC_BASEPRIORITY), BM_SETCHECK, BST_CHECKED, 0);
215 if (TaskManagerSettings.Column_HandleCount)
216 SendMessageW(GetDlgItem(hDlg, IDC_HANDLECOUNT), BM_SETCHECK, BST_CHECKED, 0);
217 if (TaskManagerSettings.Column_ThreadCount)
218 SendMessageW(GetDlgItem(hDlg, IDC_THREADCOUNT), BM_SETCHECK, BST_CHECKED, 0);
219 if (TaskManagerSettings.Column_USERObjects)
220 SendMessageW(GetDlgItem(hDlg, IDC_USEROBJECTS), BM_SETCHECK, BST_CHECKED, 0);
221 if (TaskManagerSettings.Column_GDIObjects)
222 SendMessageW(GetDlgItem(hDlg, IDC_GDIOBJECTS), BM_SETCHECK, BST_CHECKED, 0);
223 if (TaskManagerSettings.Column_IOReads)
224 SendMessageW(GetDlgItem(hDlg, IDC_IOREADS), BM_SETCHECK, BST_CHECKED, 0);
225 if (TaskManagerSettings.Column_IOWrites)
226 SendMessageW(GetDlgItem(hDlg, IDC_IOWRITES), BM_SETCHECK, BST_CHECKED, 0);
227 if (TaskManagerSettings.Column_IOOther)
228 SendMessageW(GetDlgItem(hDlg, IDC_IOOTHER), BM_SETCHECK, BST_CHECKED, 0);
229 if (TaskManagerSettings.Column_IOReadBytes)
230 SendMessageW(GetDlgItem(hDlg, IDC_IOREADBYTES), BM_SETCHECK, BST_CHECKED, 0);
231 if (TaskManagerSettings.Column_IOWriteBytes)
232 SendMessageW(GetDlgItem(hDlg, IDC_IOWRITEBYTES), BM_SETCHECK, BST_CHECKED, 0);
233 if (TaskManagerSettings.Column_IOOtherBytes)
234 SendMessageW(GetDlgItem(hDlg, IDC_IOOTHERBYTES), BM_SETCHECK, BST_CHECKED, 0);
236 return TRUE;
238 case WM_COMMAND:
240 if (LOWORD(wParam) == IDCANCEL)
242 EndDialog(hDlg, LOWORD(wParam));
243 return TRUE;
246 if (LOWORD(wParam) == IDOK)
248 TaskManagerSettings.Column_ImageName = SendMessageW(GetDlgItem(hDlg, IDC_IMAGENAME), BM_GETCHECK, 0, 0);
249 TaskManagerSettings.Column_PID = SendMessageW(GetDlgItem(hDlg, IDC_PID), BM_GETCHECK, 0, 0);
250 TaskManagerSettings.Column_UserName = SendMessageW(GetDlgItem(hDlg, IDC_USERNAME), BM_GETCHECK, 0, 0);
251 TaskManagerSettings.Column_SessionID = SendMessageW(GetDlgItem(hDlg, IDC_SESSIONID), BM_GETCHECK, 0, 0);
252 TaskManagerSettings.Column_CPUUsage = SendMessageW(GetDlgItem(hDlg, IDC_CPUUSAGE), BM_GETCHECK, 0, 0);
253 TaskManagerSettings.Column_CPUTime = SendMessageW(GetDlgItem(hDlg, IDC_CPUTIME), BM_GETCHECK, 0, 0);
254 TaskManagerSettings.Column_MemoryUsage = SendMessageW(GetDlgItem(hDlg, IDC_MEMORYUSAGE), BM_GETCHECK, 0, 0);
255 TaskManagerSettings.Column_PeakMemoryUsage = SendMessageW(GetDlgItem(hDlg, IDC_PEAKMEMORYUSAGE), BM_GETCHECK, 0, 0);
256 TaskManagerSettings.Column_MemoryUsageDelta = SendMessageW(GetDlgItem(hDlg, IDC_MEMORYUSAGEDELTA), BM_GETCHECK, 0, 0);
257 TaskManagerSettings.Column_PageFaults = SendMessageW(GetDlgItem(hDlg, IDC_PAGEFAULTS), BM_GETCHECK, 0, 0);
258 TaskManagerSettings.Column_PageFaultsDelta = SendMessageW(GetDlgItem(hDlg, IDC_PAGEFAULTSDELTA), BM_GETCHECK, 0, 0);
259 TaskManagerSettings.Column_VirtualMemorySize = SendMessageW(GetDlgItem(hDlg, IDC_VIRTUALMEMORYSIZE), BM_GETCHECK, 0, 0);
260 TaskManagerSettings.Column_PagedPool = SendMessageW(GetDlgItem(hDlg, IDC_PAGEDPOOL), BM_GETCHECK, 0, 0);
261 TaskManagerSettings.Column_NonPagedPool = SendMessageW(GetDlgItem(hDlg, IDC_NONPAGEDPOOL), BM_GETCHECK, 0, 0);
262 TaskManagerSettings.Column_BasePriority = SendMessageW(GetDlgItem(hDlg, IDC_BASEPRIORITY), BM_GETCHECK, 0, 0);
263 TaskManagerSettings.Column_HandleCount = SendMessageW(GetDlgItem(hDlg, IDC_HANDLECOUNT), BM_GETCHECK, 0, 0);
264 TaskManagerSettings.Column_ThreadCount = SendMessageW(GetDlgItem(hDlg, IDC_THREADCOUNT), BM_GETCHECK, 0, 0);
265 TaskManagerSettings.Column_USERObjects = SendMessageW(GetDlgItem(hDlg, IDC_USEROBJECTS), BM_GETCHECK, 0, 0);
266 TaskManagerSettings.Column_GDIObjects = SendMessageW(GetDlgItem(hDlg, IDC_GDIOBJECTS), BM_GETCHECK, 0, 0);
267 TaskManagerSettings.Column_IOReads = SendMessageW(GetDlgItem(hDlg, IDC_IOREADS), BM_GETCHECK, 0, 0);
268 TaskManagerSettings.Column_IOWrites = SendMessageW(GetDlgItem(hDlg, IDC_IOWRITES), BM_GETCHECK, 0, 0);
269 TaskManagerSettings.Column_IOOther = SendMessageW(GetDlgItem(hDlg, IDC_IOOTHER), BM_GETCHECK, 0, 0);
270 TaskManagerSettings.Column_IOReadBytes = SendMessageW(GetDlgItem(hDlg, IDC_IOREADBYTES), BM_GETCHECK, 0, 0);
271 TaskManagerSettings.Column_IOWriteBytes = SendMessageW(GetDlgItem(hDlg, IDC_IOWRITEBYTES), BM_GETCHECK, 0, 0);
272 TaskManagerSettings.Column_IOOtherBytes = SendMessageW(GetDlgItem(hDlg, IDC_IOOTHERBYTES), BM_GETCHECK, 0, 0);
274 EndDialog(hDlg, LOWORD(wParam));
275 return TRUE;
278 break;
281 return 0;
284 void SaveColumnSettings(void)
286 HDITEMW hditem;
287 int i;
288 WCHAR text[256];
289 int size;
291 /* Reset column data */
292 for (i=0; i<25; i++)
293 TaskManagerSettings.ColumnOrderArray[i] = i;
295 TaskManagerSettings.Column_ImageName = FALSE;
296 TaskManagerSettings.Column_PID = FALSE;
297 TaskManagerSettings.Column_CPUUsage = FALSE;
298 TaskManagerSettings.Column_CPUTime = FALSE;
299 TaskManagerSettings.Column_MemoryUsage = FALSE;
300 TaskManagerSettings.Column_MemoryUsageDelta = FALSE;
301 TaskManagerSettings.Column_PeakMemoryUsage = FALSE;
302 TaskManagerSettings.Column_PageFaults = FALSE;
303 TaskManagerSettings.Column_USERObjects = FALSE;
304 TaskManagerSettings.Column_IOReads = FALSE;
305 TaskManagerSettings.Column_IOReadBytes = FALSE;
306 TaskManagerSettings.Column_SessionID = FALSE;
307 TaskManagerSettings.Column_UserName = FALSE;
308 TaskManagerSettings.Column_PageFaultsDelta = FALSE;
309 TaskManagerSettings.Column_VirtualMemorySize = FALSE;
310 TaskManagerSettings.Column_PagedPool = FALSE;
311 TaskManagerSettings.Column_NonPagedPool = FALSE;
312 TaskManagerSettings.Column_BasePriority = FALSE;
313 TaskManagerSettings.Column_HandleCount = FALSE;
314 TaskManagerSettings.Column_ThreadCount = FALSE;
315 TaskManagerSettings.Column_GDIObjects = FALSE;
316 TaskManagerSettings.Column_IOWrites = FALSE;
317 TaskManagerSettings.Column_IOWriteBytes = FALSE;
318 TaskManagerSettings.Column_IOOther = FALSE;
319 TaskManagerSettings.Column_IOOtherBytes = FALSE;
320 TaskManagerSettings.ColumnSizeArray[0] = 105;
321 TaskManagerSettings.ColumnSizeArray[1] = 50;
322 TaskManagerSettings.ColumnSizeArray[2] = 107;
323 TaskManagerSettings.ColumnSizeArray[3] = 70;
324 TaskManagerSettings.ColumnSizeArray[4] = 35;
325 TaskManagerSettings.ColumnSizeArray[5] = 70;
326 TaskManagerSettings.ColumnSizeArray[6] = 70;
327 TaskManagerSettings.ColumnSizeArray[7] = 100;
328 TaskManagerSettings.ColumnSizeArray[8] = 70;
329 TaskManagerSettings.ColumnSizeArray[9] = 70;
330 TaskManagerSettings.ColumnSizeArray[10] = 70;
331 TaskManagerSettings.ColumnSizeArray[11] = 70;
332 TaskManagerSettings.ColumnSizeArray[12] = 70;
333 TaskManagerSettings.ColumnSizeArray[13] = 70;
334 TaskManagerSettings.ColumnSizeArray[14] = 60;
335 TaskManagerSettings.ColumnSizeArray[15] = 60;
336 TaskManagerSettings.ColumnSizeArray[16] = 60;
337 TaskManagerSettings.ColumnSizeArray[17] = 60;
338 TaskManagerSettings.ColumnSizeArray[18] = 60;
339 TaskManagerSettings.ColumnSizeArray[19] = 70;
340 TaskManagerSettings.ColumnSizeArray[20] = 70;
341 TaskManagerSettings.ColumnSizeArray[21] = 70;
342 TaskManagerSettings.ColumnSizeArray[22] = 70;
343 TaskManagerSettings.ColumnSizeArray[23] = 70;
344 TaskManagerSettings.ColumnSizeArray[24] = 70;
346 /* Get header order */
347 size = SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0);
348 SendMessageW(hProcessPageHeaderCtrl, HDM_GETORDERARRAY, (WPARAM) size, (LPARAM) &TaskManagerSettings.ColumnOrderArray);
350 /* Get visible columns */
351 for (i=0; i<SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0); i++) {
352 memset(&hditem, 0, sizeof(HDITEMW));
354 hditem.mask = HDI_TEXT|HDI_WIDTH;
355 hditem.pszText = text;
356 hditem.cchTextMax = 256;
358 SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEMW, i, (LPARAM) &hditem);
360 if (lstrcmpW(text, wszImageName) == 0)
362 TaskManagerSettings.Column_ImageName = TRUE;
363 TaskManagerSettings.ColumnSizeArray[0] = hditem.cxy;
365 if (lstrcmpW(text, wszPID) == 0)
367 TaskManagerSettings.Column_PID = TRUE;
368 TaskManagerSettings.ColumnSizeArray[1] = hditem.cxy;
370 if (lstrcmpW(text, wszUserName) == 0)
372 TaskManagerSettings.Column_UserName = TRUE;
373 TaskManagerSettings.ColumnSizeArray[2] = hditem.cxy;
375 if (lstrcmpW(text, wszSessionID) == 0)
377 TaskManagerSettings.Column_SessionID = TRUE;
378 TaskManagerSettings.ColumnSizeArray[3] = hditem.cxy;
380 if (lstrcmpW(text, wszCPU) == 0)
382 TaskManagerSettings.Column_CPUUsage = TRUE;
383 TaskManagerSettings.ColumnSizeArray[4] = hditem.cxy;
385 if (lstrcmpW(text, wszCPUTime) == 0)
387 TaskManagerSettings.Column_CPUTime = TRUE;
388 TaskManagerSettings.ColumnSizeArray[5] = hditem.cxy;
390 if (lstrcmpW(text, wszMemUsage) == 0)
392 TaskManagerSettings.Column_MemoryUsage = TRUE;
393 TaskManagerSettings.ColumnSizeArray[6] = hditem.cxy;
395 if (lstrcmpW(text, wszPeakMemUsage) == 0)
397 TaskManagerSettings.Column_PeakMemoryUsage = TRUE;
398 TaskManagerSettings.ColumnSizeArray[7] = hditem.cxy;
400 if (lstrcmpW(text, wszMemDelta) == 0)
402 TaskManagerSettings.Column_MemoryUsageDelta = TRUE;
403 TaskManagerSettings.ColumnSizeArray[8] = hditem.cxy;
405 if (lstrcmpW(text, wszPageFaults) == 0)
407 TaskManagerSettings.Column_PageFaults = TRUE;
408 TaskManagerSettings.ColumnSizeArray[9] = hditem.cxy;
410 if (lstrcmpW(text, wszPFDelta) == 0)
412 TaskManagerSettings.Column_PageFaultsDelta = TRUE;
413 TaskManagerSettings.ColumnSizeArray[10] = hditem.cxy;
415 if (lstrcmpW(text, wszVMSize) == 0)
417 TaskManagerSettings.Column_VirtualMemorySize = TRUE;
418 TaskManagerSettings.ColumnSizeArray[11] = hditem.cxy;
420 if (lstrcmpW(text, wszPagedPool) == 0)
422 TaskManagerSettings.Column_PagedPool = TRUE;
423 TaskManagerSettings.ColumnSizeArray[12] = hditem.cxy;
425 if (lstrcmpW(text, wszNPPool) == 0)
427 TaskManagerSettings.Column_NonPagedPool = TRUE;
428 TaskManagerSettings.ColumnSizeArray[13] = hditem.cxy;
430 if (lstrcmpW(text, wszBasePri) == 0)
432 TaskManagerSettings.Column_BasePriority = TRUE;
433 TaskManagerSettings.ColumnSizeArray[14] = hditem.cxy;
435 if (lstrcmpW(text, wszHandles) == 0)
437 TaskManagerSettings.Column_HandleCount = TRUE;
438 TaskManagerSettings.ColumnSizeArray[15] = hditem.cxy;
440 if (lstrcmpW(text, wszThreads) == 0)
442 TaskManagerSettings.Column_ThreadCount = TRUE;
443 TaskManagerSettings.ColumnSizeArray[16] = hditem.cxy;
445 if (lstrcmpW(text, wszUSERObjects) == 0)
447 TaskManagerSettings.Column_USERObjects = TRUE;
448 TaskManagerSettings.ColumnSizeArray[17] = hditem.cxy;
450 if (lstrcmpW(text, wszGDIObjects) == 0)
452 TaskManagerSettings.Column_GDIObjects = TRUE;
453 TaskManagerSettings.ColumnSizeArray[18] = hditem.cxy;
455 if (lstrcmpW(text, wszIOReads) == 0)
457 TaskManagerSettings.Column_IOReads = TRUE;
458 TaskManagerSettings.ColumnSizeArray[19] = hditem.cxy;
460 if (lstrcmpW(text, wszIOWrites) == 0)
462 TaskManagerSettings.Column_IOWrites = TRUE;
463 TaskManagerSettings.ColumnSizeArray[20] = hditem.cxy;
465 if (lstrcmpW(text, wszIOOther) == 0)
467 TaskManagerSettings.Column_IOOther = TRUE;
468 TaskManagerSettings.ColumnSizeArray[21] = hditem.cxy;
470 if (lstrcmpW(text, wszIOReadBytes) == 0)
472 TaskManagerSettings.Column_IOReadBytes = TRUE;
473 TaskManagerSettings.ColumnSizeArray[22] = hditem.cxy;
475 if (lstrcmpW(text, wszIOWriteBytes) == 0)
477 TaskManagerSettings.Column_IOWriteBytes = TRUE;
478 TaskManagerSettings.ColumnSizeArray[23] = hditem.cxy;
480 if (lstrcmpW(text, wszIOOtherBytes) == 0)
482 TaskManagerSettings.Column_IOOtherBytes = TRUE;
483 TaskManagerSettings.ColumnSizeArray[24] = hditem.cxy;
488 void ProcessPage_OnViewSelectColumns(void)
490 int i;
492 if (DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_COLUMNS_DIALOG), hMainWnd, ColumnsDialogWndProc) == IDOK)
494 for (i=SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0)-1; i>=0; i--)
496 SendMessageW(hProcessPageListCtrl, LVM_DELETECOLUMN, 0, i);
499 for (i=0; i<25; i++)
500 TaskManagerSettings.ColumnOrderArray[i] = i;
502 TaskManagerSettings.ColumnSizeArray[0] = 105;
503 TaskManagerSettings.ColumnSizeArray[1] = 50;
504 TaskManagerSettings.ColumnSizeArray[2] = 107;
505 TaskManagerSettings.ColumnSizeArray[3] = 70;
506 TaskManagerSettings.ColumnSizeArray[4] = 35;
507 TaskManagerSettings.ColumnSizeArray[5] = 70;
508 TaskManagerSettings.ColumnSizeArray[6] = 70;
509 TaskManagerSettings.ColumnSizeArray[7] = 100;
510 TaskManagerSettings.ColumnSizeArray[8] = 70;
511 TaskManagerSettings.ColumnSizeArray[9] = 70;
512 TaskManagerSettings.ColumnSizeArray[10] = 70;
513 TaskManagerSettings.ColumnSizeArray[11] = 70;
514 TaskManagerSettings.ColumnSizeArray[12] = 70;
515 TaskManagerSettings.ColumnSizeArray[13] = 70;
516 TaskManagerSettings.ColumnSizeArray[14] = 60;
517 TaskManagerSettings.ColumnSizeArray[15] = 60;
518 TaskManagerSettings.ColumnSizeArray[16] = 60;
519 TaskManagerSettings.ColumnSizeArray[17] = 60;
520 TaskManagerSettings.ColumnSizeArray[18] = 60;
521 TaskManagerSettings.ColumnSizeArray[19] = 70;
522 TaskManagerSettings.ColumnSizeArray[20] = 70;
523 TaskManagerSettings.ColumnSizeArray[21] = 70;
524 TaskManagerSettings.ColumnSizeArray[22] = 70;
525 TaskManagerSettings.ColumnSizeArray[23] = 70;
526 TaskManagerSettings.ColumnSizeArray[24] = 70;
528 AddColumns();
532 void UpdateColumnDataHints(void)
534 HDITEMW hditem;
535 WCHAR text[256];
536 ULONG Index;
538 for (Index=0; Index<(ULONG)SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0); Index++)
540 memset(&hditem, 0, sizeof(HDITEMW));
542 hditem.mask = HDI_TEXT;
543 hditem.pszText = text;
544 hditem.cchTextMax = 260;
546 SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEMW, Index, (LPARAM) &hditem);
548 if (lstrcmpW(text, wszImageName) == 0)
549 ColumnDataHints[Index] = COLUMN_IMAGENAME;
550 if (lstrcmpW(text, wszPID) == 0)
551 ColumnDataHints[Index] = COLUMN_PID;
552 if (lstrcmpW(text, wszUserName) == 0)
553 ColumnDataHints[Index] = COLUMN_USERNAME;
554 if (lstrcmpW(text, wszSessionID) == 0)
555 ColumnDataHints[Index] = COLUMN_SESSIONID;
556 if (lstrcmpW(text, wszCPU) == 0)
557 ColumnDataHints[Index] = COLUMN_CPUUSAGE;
558 if (lstrcmpW(text, wszCPUTime) == 0)
559 ColumnDataHints[Index] = COLUMN_CPUTIME;
560 if (lstrcmpW(text, wszMemUsage) == 0)
561 ColumnDataHints[Index] = COLUMN_MEMORYUSAGE;
562 if (lstrcmpW(text, wszPeakMemUsage) == 0)
563 ColumnDataHints[Index] = COLUMN_PEAKMEMORYUSAGE;
564 if (lstrcmpW(text, wszMemDelta) == 0)
565 ColumnDataHints[Index] = COLUMN_MEMORYUSAGEDELTA;
566 if (lstrcmpW(text, wszPageFaults) == 0)
567 ColumnDataHints[Index] = COLUMN_PAGEFAULTS;
568 if (lstrcmpW(text, wszPFDelta) == 0)
569 ColumnDataHints[Index] = COLUMN_PAGEFAULTSDELTA;
570 if (lstrcmpW(text, wszVMSize) == 0)
571 ColumnDataHints[Index] = COLUMN_VIRTUALMEMORYSIZE;
572 if (lstrcmpW(text, wszPagedPool) == 0)
573 ColumnDataHints[Index] = COLUMN_PAGEDPOOL;
574 if (lstrcmpW(text, wszNPPool) == 0)
575 ColumnDataHints[Index] = COLUMN_NONPAGEDPOOL;
576 if (lstrcmpW(text, wszBasePri) == 0)
577 ColumnDataHints[Index] = COLUMN_BASEPRIORITY;
578 if (lstrcmpW(text, wszHandles) == 0)
579 ColumnDataHints[Index] = COLUMN_HANDLECOUNT;
580 if (lstrcmpW(text, wszThreads) == 0)
581 ColumnDataHints[Index] = COLUMN_THREADCOUNT;
582 if (lstrcmpW(text, wszUSERObjects) == 0)
583 ColumnDataHints[Index] = COLUMN_USEROBJECTS;
584 if (lstrcmpW(text, wszGDIObjects) == 0)
585 ColumnDataHints[Index] = COLUMN_GDIOBJECTS;
586 if (lstrcmpW(text, wszIOReads) == 0)
587 ColumnDataHints[Index] = COLUMN_IOREADS;
588 if (lstrcmpW(text, wszIOWrites) == 0)
589 ColumnDataHints[Index] = COLUMN_IOWRITES;
590 if (lstrcmpW(text, wszIOOther) == 0)
591 ColumnDataHints[Index] = COLUMN_IOOTHER;
592 if (lstrcmpW(text, wszIOReadBytes) == 0)
593 ColumnDataHints[Index] = COLUMN_IOREADBYTES;
594 if (lstrcmpW(text, wszIOWriteBytes) == 0)
595 ColumnDataHints[Index] = COLUMN_IOWRITEBYTES;
596 if (lstrcmpW(text, wszIOOtherBytes) == 0)
597 ColumnDataHints[Index] = COLUMN_IOOTHERBYTES;