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
30 #include "wine/unicode.h"
34 UINT ColumnDataHints
[25];
36 /* Column Headers; Begin */
37 static WCHAR wszImageName
[255];
38 static WCHAR wszPID
[255];
39 static WCHAR wszUserName
[255];
40 static WCHAR wszSessionID
[255];
41 static WCHAR wszCPU
[255];
42 static WCHAR wszCPUTime
[255];
43 static WCHAR wszMemUsage
[255];
44 static WCHAR wszPeakMemUsage
[255];
45 static WCHAR wszMemDelta
[255];
46 static WCHAR wszPageFaults
[255];
47 static WCHAR wszPFDelta
[255];
48 static WCHAR wszVMSize
[255];
49 static WCHAR wszPagedPool
[255];
50 static WCHAR wszNPPool
[255];
51 static WCHAR wszBasePri
[255];
52 static WCHAR wszHandles
[255];
53 static WCHAR wszThreads
[255];
54 static WCHAR wszUSERObjects
[255];
55 static WCHAR wszGDIObjects
[255];
56 static WCHAR wszIOReads
[255];
57 static WCHAR wszIOWrites
[255];
58 static WCHAR wszIOOther
[255];
59 static WCHAR wszIOReadBytes
[255];
60 static WCHAR wszIOWriteBytes
[255];
61 static WCHAR wszIOOtherBytes
[255];
62 /* Column Headers; End */
64 static void load_column_headers(void)
66 LoadStringW(hInst
, IDS_IMAGENAME
, wszImageName
, sizeof(wszImageName
)/sizeof(WCHAR
));
67 LoadStringW(hInst
, IDS_PID
, wszPID
, sizeof(wszPID
)/sizeof(WCHAR
));
68 LoadStringW(hInst
, IDS_USERNAME
, wszUserName
, sizeof(wszUserName
)/sizeof(WCHAR
));
69 LoadStringW(hInst
, IDS_SESSIONID
, wszSessionID
, sizeof(wszSessionID
)/sizeof(WCHAR
));
70 LoadStringW(hInst
, IDS_CPUUSAGE
, wszCPU
, sizeof(wszCPU
)/sizeof(WCHAR
));
71 LoadStringW(hInst
, IDS_CPUTIME
, wszCPUTime
, sizeof(wszCPUTime
)/sizeof(WCHAR
));
72 LoadStringW(hInst
, IDS_MEMORYUSAGE
, wszMemUsage
, sizeof(wszMemUsage
)/sizeof(WCHAR
));
73 LoadStringW(hInst
, IDS_PEAKMEMORYUSAGE
, wszPeakMemUsage
, sizeof(wszPeakMemUsage
)/sizeof(WCHAR
));
74 LoadStringW(hInst
, IDS_MEMORYUSAGEDELTA
, wszMemDelta
, sizeof(wszMemDelta
)/sizeof(WCHAR
));
75 LoadStringW(hInst
, IDS_PAGEFAULTS
, wszPageFaults
, sizeof(wszPageFaults
)/sizeof(WCHAR
));
76 LoadStringW(hInst
, IDS_PAGEFAULTSDELTA
, wszPFDelta
, sizeof(wszPFDelta
)/sizeof(WCHAR
));
77 LoadStringW(hInst
, IDS_VIRTUALMEMORYSIZE
, wszVMSize
, sizeof(wszVMSize
)/sizeof(WCHAR
));
78 LoadStringW(hInst
, IDS_PAGEDPOOL
, wszPagedPool
, sizeof(wszPagedPool
)/sizeof(WCHAR
));
79 LoadStringW(hInst
, IDS_NONPAGEDPOOL
, wszNPPool
, sizeof(wszNPPool
)/sizeof(WCHAR
));
80 LoadStringW(hInst
, IDS_BASEPRIORITY
, wszBasePri
, sizeof(wszBasePri
)/sizeof(WCHAR
));
81 LoadStringW(hInst
, IDS_HANDLECOUNT
, wszHandles
, sizeof(wszHandles
)/sizeof(WCHAR
));
82 LoadStringW(hInst
, IDS_THREADCOUNT
, wszThreads
, sizeof(wszThreads
)/sizeof(WCHAR
));
83 LoadStringW(hInst
, IDS_USEROBJECTS
, wszUSERObjects
, sizeof(wszUSERObjects
)/sizeof(WCHAR
));
84 LoadStringW(hInst
, IDS_GDIOBJECTS
, wszGDIObjects
, sizeof(wszGDIObjects
)/sizeof(WCHAR
));
85 LoadStringW(hInst
, IDS_IOREADS
, wszIOReads
, sizeof(wszIOReads
)/sizeof(WCHAR
));
86 LoadStringW(hInst
, IDS_IOWRITES
, wszIOWrites
, sizeof(wszIOWrites
)/sizeof(WCHAR
));
87 LoadStringW(hInst
, IDS_IOOTHER
, wszIOOther
, sizeof(wszIOOther
)/sizeof(WCHAR
));
88 LoadStringW(hInst
, IDS_IOREADBYTES
, wszIOReadBytes
, sizeof(wszIOReadBytes
)/sizeof(WCHAR
));
89 LoadStringW(hInst
, IDS_IOWRITEBYTES
, wszIOWriteBytes
, sizeof(wszIOWriteBytes
)/sizeof(WCHAR
));
90 LoadStringW(hInst
, IDS_IOOTHERBYTES
, wszIOOtherBytes
, sizeof(wszIOOtherBytes
)/sizeof(WCHAR
));
93 static int InsertColumn(int nCol
, LPCWSTR lpszColumnHeading
, int nFormat
, int nWidth
, int nSubItem
)
97 column
.mask
= LVCF_TEXT
|LVCF_FMT
;
98 column
.pszText
= (LPWSTR
)lpszColumnHeading
;
103 column
.mask
|= LVCF_WIDTH
;
109 column
.mask
|= LVCF_SUBITEM
;
110 column
.iSubItem
= nSubItem
;
113 return ListView_InsertColumnW(hProcessPageListCtrl
, nCol
, &column
);
116 void AddColumns(void)
120 load_column_headers();
122 if (TaskManagerSettings
.Column_ImageName
)
123 InsertColumn(0, wszImageName
, LVCFMT_LEFT
, TaskManagerSettings
.ColumnSizeArray
[0], -1);
124 if (TaskManagerSettings
.Column_PID
)
125 InsertColumn(1, wszPID
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[1], -1);
126 if (TaskManagerSettings
.Column_UserName
)
127 InsertColumn(2, wszUserName
, LVCFMT_LEFT
, TaskManagerSettings
.ColumnSizeArray
[2], -1);
128 if (TaskManagerSettings
.Column_SessionID
)
129 InsertColumn(3, wszSessionID
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[3], -1);
130 if (TaskManagerSettings
.Column_CPUUsage
)
131 InsertColumn(4, wszCPU
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[4], -1);
132 if (TaskManagerSettings
.Column_CPUTime
)
133 InsertColumn(5, wszCPUTime
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[5], -1);
134 if (TaskManagerSettings
.Column_MemoryUsage
)
135 InsertColumn(6, wszMemUsage
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[6], -1);
136 if (TaskManagerSettings
.Column_PeakMemoryUsage
)
137 InsertColumn(7, wszPeakMemUsage
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[7], -1);
138 if (TaskManagerSettings
.Column_MemoryUsageDelta
)
139 InsertColumn(8, wszMemDelta
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[8], -1);
140 if (TaskManagerSettings
.Column_PageFaults
)
141 InsertColumn(9, wszPageFaults
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[9], -1);
142 if (TaskManagerSettings
.Column_PageFaultsDelta
)
143 InsertColumn(10, wszPFDelta
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[10], -1);
144 if (TaskManagerSettings
.Column_VirtualMemorySize
)
145 InsertColumn(11, wszVMSize
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[11], -1);
146 if (TaskManagerSettings
.Column_PagedPool
)
147 InsertColumn(12, wszPagedPool
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[12], -1);
148 if (TaskManagerSettings
.Column_NonPagedPool
)
149 InsertColumn(13, wszNPPool
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[13], -1);
150 if (TaskManagerSettings
.Column_BasePriority
)
151 InsertColumn(14, wszBasePri
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[14], -1);
152 if (TaskManagerSettings
.Column_HandleCount
)
153 InsertColumn(15, wszHandles
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[15], -1);
154 if (TaskManagerSettings
.Column_ThreadCount
)
155 InsertColumn(16, wszThreads
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[16], -1);
156 if (TaskManagerSettings
.Column_USERObjects
)
157 InsertColumn(17, wszUSERObjects
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[17], -1);
158 if (TaskManagerSettings
.Column_GDIObjects
)
159 InsertColumn(18, wszGDIObjects
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[18], -1);
160 if (TaskManagerSettings
.Column_IOReads
)
161 InsertColumn(19, wszIOReads
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[19], -1);
162 if (TaskManagerSettings
.Column_IOWrites
)
163 InsertColumn(20, wszIOWrites
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[20], -1);
164 if (TaskManagerSettings
.Column_IOOther
)
165 InsertColumn(21, wszIOOther
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[21], -1);
166 if (TaskManagerSettings
.Column_IOReadBytes
)
167 InsertColumn(22, wszIOReadBytes
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[22], -1);
168 if (TaskManagerSettings
.Column_IOWriteBytes
)
169 InsertColumn(23, wszIOWriteBytes
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[23], -1);
170 if (TaskManagerSettings
.Column_IOOtherBytes
)
171 InsertColumn(24, wszIOOtherBytes
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[24], -1);
173 size
= SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMCOUNT
, 0, 0);
174 SendMessageW(hProcessPageListCtrl
, LVM_SETCOLUMNORDERARRAY
, (WPARAM
) size
, (LPARAM
) &TaskManagerSettings
.ColumnOrderArray
);
176 UpdateColumnDataHints();
179 static INT_PTR CALLBACK
ColumnsDialogWndProc(HWND hDlg
, UINT message
, WPARAM wParam
, LPARAM lParam
)
186 if (TaskManagerSettings
.Column_ImageName
)
187 SendMessageW(GetDlgItem(hDlg
, IDC_IMAGENAME
), BM_SETCHECK
, BST_CHECKED
, 0);
188 if (TaskManagerSettings
.Column_PID
)
189 SendMessageW(GetDlgItem(hDlg
, IDC_PID
), BM_SETCHECK
, BST_CHECKED
, 0);
190 if (TaskManagerSettings
.Column_UserName
)
191 SendMessageW(GetDlgItem(hDlg
, IDC_USERNAME
), BM_SETCHECK
, BST_CHECKED
, 0);
192 if (TaskManagerSettings
.Column_SessionID
)
193 SendMessageW(GetDlgItem(hDlg
, IDC_SESSIONID
), BM_SETCHECK
, BST_CHECKED
, 0);
194 if (TaskManagerSettings
.Column_CPUUsage
)
195 SendMessageW(GetDlgItem(hDlg
, IDC_CPUUSAGE
), BM_SETCHECK
, BST_CHECKED
, 0);
196 if (TaskManagerSettings
.Column_CPUTime
)
197 SendMessageW(GetDlgItem(hDlg
, IDC_CPUTIME
), BM_SETCHECK
, BST_CHECKED
, 0);
198 if (TaskManagerSettings
.Column_MemoryUsage
)
199 SendMessageW(GetDlgItem(hDlg
, IDC_MEMORYUSAGE
), BM_SETCHECK
, BST_CHECKED
, 0);
200 if (TaskManagerSettings
.Column_PeakMemoryUsage
)
201 SendMessageW(GetDlgItem(hDlg
, IDC_PEAKMEMORYUSAGE
), BM_SETCHECK
, BST_CHECKED
, 0);
202 if (TaskManagerSettings
.Column_MemoryUsageDelta
)
203 SendMessageW(GetDlgItem(hDlg
, IDC_MEMORYUSAGEDELTA
), BM_SETCHECK
, BST_CHECKED
, 0);
204 if (TaskManagerSettings
.Column_PageFaults
)
205 SendMessageW(GetDlgItem(hDlg
, IDC_PAGEFAULTS
), BM_SETCHECK
, BST_CHECKED
, 0);
206 if (TaskManagerSettings
.Column_PageFaultsDelta
)
207 SendMessageW(GetDlgItem(hDlg
, IDC_PAGEFAULTSDELTA
), BM_SETCHECK
, BST_CHECKED
, 0);
208 if (TaskManagerSettings
.Column_VirtualMemorySize
)
209 SendMessageW(GetDlgItem(hDlg
, IDC_VIRTUALMEMORYSIZE
), BM_SETCHECK
, BST_CHECKED
, 0);
210 if (TaskManagerSettings
.Column_PagedPool
)
211 SendMessageW(GetDlgItem(hDlg
, IDC_PAGEDPOOL
), BM_SETCHECK
, BST_CHECKED
, 0);
212 if (TaskManagerSettings
.Column_NonPagedPool
)
213 SendMessageW(GetDlgItem(hDlg
, IDC_NONPAGEDPOOL
), BM_SETCHECK
, BST_CHECKED
, 0);
214 if (TaskManagerSettings
.Column_BasePriority
)
215 SendMessageW(GetDlgItem(hDlg
, IDC_BASEPRIORITY
), BM_SETCHECK
, BST_CHECKED
, 0);
216 if (TaskManagerSettings
.Column_HandleCount
)
217 SendMessageW(GetDlgItem(hDlg
, IDC_HANDLECOUNT
), BM_SETCHECK
, BST_CHECKED
, 0);
218 if (TaskManagerSettings
.Column_ThreadCount
)
219 SendMessageW(GetDlgItem(hDlg
, IDC_THREADCOUNT
), BM_SETCHECK
, BST_CHECKED
, 0);
220 if (TaskManagerSettings
.Column_USERObjects
)
221 SendMessageW(GetDlgItem(hDlg
, IDC_USEROBJECTS
), BM_SETCHECK
, BST_CHECKED
, 0);
222 if (TaskManagerSettings
.Column_GDIObjects
)
223 SendMessageW(GetDlgItem(hDlg
, IDC_GDIOBJECTS
), BM_SETCHECK
, BST_CHECKED
, 0);
224 if (TaskManagerSettings
.Column_IOReads
)
225 SendMessageW(GetDlgItem(hDlg
, IDC_IOREADS
), BM_SETCHECK
, BST_CHECKED
, 0);
226 if (TaskManagerSettings
.Column_IOWrites
)
227 SendMessageW(GetDlgItem(hDlg
, IDC_IOWRITES
), BM_SETCHECK
, BST_CHECKED
, 0);
228 if (TaskManagerSettings
.Column_IOOther
)
229 SendMessageW(GetDlgItem(hDlg
, IDC_IOOTHER
), BM_SETCHECK
, BST_CHECKED
, 0);
230 if (TaskManagerSettings
.Column_IOReadBytes
)
231 SendMessageW(GetDlgItem(hDlg
, IDC_IOREADBYTES
), BM_SETCHECK
, BST_CHECKED
, 0);
232 if (TaskManagerSettings
.Column_IOWriteBytes
)
233 SendMessageW(GetDlgItem(hDlg
, IDC_IOWRITEBYTES
), BM_SETCHECK
, BST_CHECKED
, 0);
234 if (TaskManagerSettings
.Column_IOOtherBytes
)
235 SendMessageW(GetDlgItem(hDlg
, IDC_IOOTHERBYTES
), BM_SETCHECK
, BST_CHECKED
, 0);
241 if (LOWORD(wParam
) == IDCANCEL
)
243 EndDialog(hDlg
, LOWORD(wParam
));
247 if (LOWORD(wParam
) == IDOK
)
249 TaskManagerSettings
.Column_ImageName
= SendMessageW(GetDlgItem(hDlg
, IDC_IMAGENAME
), BM_GETCHECK
, 0, 0);
250 TaskManagerSettings
.Column_PID
= SendMessageW(GetDlgItem(hDlg
, IDC_PID
), BM_GETCHECK
, 0, 0);
251 TaskManagerSettings
.Column_UserName
= SendMessageW(GetDlgItem(hDlg
, IDC_USERNAME
), BM_GETCHECK
, 0, 0);
252 TaskManagerSettings
.Column_SessionID
= SendMessageW(GetDlgItem(hDlg
, IDC_SESSIONID
), BM_GETCHECK
, 0, 0);
253 TaskManagerSettings
.Column_CPUUsage
= SendMessageW(GetDlgItem(hDlg
, IDC_CPUUSAGE
), BM_GETCHECK
, 0, 0);
254 TaskManagerSettings
.Column_CPUTime
= SendMessageW(GetDlgItem(hDlg
, IDC_CPUTIME
), BM_GETCHECK
, 0, 0);
255 TaskManagerSettings
.Column_MemoryUsage
= SendMessageW(GetDlgItem(hDlg
, IDC_MEMORYUSAGE
), BM_GETCHECK
, 0, 0);
256 TaskManagerSettings
.Column_PeakMemoryUsage
= SendMessageW(GetDlgItem(hDlg
, IDC_PEAKMEMORYUSAGE
), BM_GETCHECK
, 0, 0);
257 TaskManagerSettings
.Column_MemoryUsageDelta
= SendMessageW(GetDlgItem(hDlg
, IDC_MEMORYUSAGEDELTA
), BM_GETCHECK
, 0, 0);
258 TaskManagerSettings
.Column_PageFaults
= SendMessageW(GetDlgItem(hDlg
, IDC_PAGEFAULTS
), BM_GETCHECK
, 0, 0);
259 TaskManagerSettings
.Column_PageFaultsDelta
= SendMessageW(GetDlgItem(hDlg
, IDC_PAGEFAULTSDELTA
), BM_GETCHECK
, 0, 0);
260 TaskManagerSettings
.Column_VirtualMemorySize
= SendMessageW(GetDlgItem(hDlg
, IDC_VIRTUALMEMORYSIZE
), BM_GETCHECK
, 0, 0);
261 TaskManagerSettings
.Column_PagedPool
= SendMessageW(GetDlgItem(hDlg
, IDC_PAGEDPOOL
), BM_GETCHECK
, 0, 0);
262 TaskManagerSettings
.Column_NonPagedPool
= SendMessageW(GetDlgItem(hDlg
, IDC_NONPAGEDPOOL
), BM_GETCHECK
, 0, 0);
263 TaskManagerSettings
.Column_BasePriority
= SendMessageW(GetDlgItem(hDlg
, IDC_BASEPRIORITY
), BM_GETCHECK
, 0, 0);
264 TaskManagerSettings
.Column_HandleCount
= SendMessageW(GetDlgItem(hDlg
, IDC_HANDLECOUNT
), BM_GETCHECK
, 0, 0);
265 TaskManagerSettings
.Column_ThreadCount
= SendMessageW(GetDlgItem(hDlg
, IDC_THREADCOUNT
), BM_GETCHECK
, 0, 0);
266 TaskManagerSettings
.Column_USERObjects
= SendMessageW(GetDlgItem(hDlg
, IDC_USEROBJECTS
), BM_GETCHECK
, 0, 0);
267 TaskManagerSettings
.Column_GDIObjects
= SendMessageW(GetDlgItem(hDlg
, IDC_GDIOBJECTS
), BM_GETCHECK
, 0, 0);
268 TaskManagerSettings
.Column_IOReads
= SendMessageW(GetDlgItem(hDlg
, IDC_IOREADS
), BM_GETCHECK
, 0, 0);
269 TaskManagerSettings
.Column_IOWrites
= SendMessageW(GetDlgItem(hDlg
, IDC_IOWRITES
), BM_GETCHECK
, 0, 0);
270 TaskManagerSettings
.Column_IOOther
= SendMessageW(GetDlgItem(hDlg
, IDC_IOOTHER
), BM_GETCHECK
, 0, 0);
271 TaskManagerSettings
.Column_IOReadBytes
= SendMessageW(GetDlgItem(hDlg
, IDC_IOREADBYTES
), BM_GETCHECK
, 0, 0);
272 TaskManagerSettings
.Column_IOWriteBytes
= SendMessageW(GetDlgItem(hDlg
, IDC_IOWRITEBYTES
), BM_GETCHECK
, 0, 0);
273 TaskManagerSettings
.Column_IOOtherBytes
= SendMessageW(GetDlgItem(hDlg
, IDC_IOOTHERBYTES
), BM_GETCHECK
, 0, 0);
275 EndDialog(hDlg
, LOWORD(wParam
));
285 void SaveColumnSettings(void)
292 /* Reset column data */
294 TaskManagerSettings
.ColumnOrderArray
[i
] = i
;
296 TaskManagerSettings
.Column_ImageName
= FALSE
;
297 TaskManagerSettings
.Column_PID
= FALSE
;
298 TaskManagerSettings
.Column_CPUUsage
= FALSE
;
299 TaskManagerSettings
.Column_CPUTime
= FALSE
;
300 TaskManagerSettings
.Column_MemoryUsage
= FALSE
;
301 TaskManagerSettings
.Column_MemoryUsageDelta
= FALSE
;
302 TaskManagerSettings
.Column_PeakMemoryUsage
= FALSE
;
303 TaskManagerSettings
.Column_PageFaults
= FALSE
;
304 TaskManagerSettings
.Column_USERObjects
= FALSE
;
305 TaskManagerSettings
.Column_IOReads
= FALSE
;
306 TaskManagerSettings
.Column_IOReadBytes
= FALSE
;
307 TaskManagerSettings
.Column_SessionID
= FALSE
;
308 TaskManagerSettings
.Column_UserName
= FALSE
;
309 TaskManagerSettings
.Column_PageFaultsDelta
= FALSE
;
310 TaskManagerSettings
.Column_VirtualMemorySize
= FALSE
;
311 TaskManagerSettings
.Column_PagedPool
= FALSE
;
312 TaskManagerSettings
.Column_NonPagedPool
= FALSE
;
313 TaskManagerSettings
.Column_BasePriority
= FALSE
;
314 TaskManagerSettings
.Column_HandleCount
= FALSE
;
315 TaskManagerSettings
.Column_ThreadCount
= FALSE
;
316 TaskManagerSettings
.Column_GDIObjects
= FALSE
;
317 TaskManagerSettings
.Column_IOWrites
= FALSE
;
318 TaskManagerSettings
.Column_IOWriteBytes
= FALSE
;
319 TaskManagerSettings
.Column_IOOther
= FALSE
;
320 TaskManagerSettings
.Column_IOOtherBytes
= FALSE
;
321 TaskManagerSettings
.ColumnSizeArray
[0] = 105;
322 TaskManagerSettings
.ColumnSizeArray
[1] = 50;
323 TaskManagerSettings
.ColumnSizeArray
[2] = 107;
324 TaskManagerSettings
.ColumnSizeArray
[3] = 70;
325 TaskManagerSettings
.ColumnSizeArray
[4] = 35;
326 TaskManagerSettings
.ColumnSizeArray
[5] = 70;
327 TaskManagerSettings
.ColumnSizeArray
[6] = 70;
328 TaskManagerSettings
.ColumnSizeArray
[7] = 100;
329 TaskManagerSettings
.ColumnSizeArray
[8] = 70;
330 TaskManagerSettings
.ColumnSizeArray
[9] = 70;
331 TaskManagerSettings
.ColumnSizeArray
[10] = 70;
332 TaskManagerSettings
.ColumnSizeArray
[11] = 70;
333 TaskManagerSettings
.ColumnSizeArray
[12] = 70;
334 TaskManagerSettings
.ColumnSizeArray
[13] = 70;
335 TaskManagerSettings
.ColumnSizeArray
[14] = 60;
336 TaskManagerSettings
.ColumnSizeArray
[15] = 60;
337 TaskManagerSettings
.ColumnSizeArray
[16] = 60;
338 TaskManagerSettings
.ColumnSizeArray
[17] = 60;
339 TaskManagerSettings
.ColumnSizeArray
[18] = 60;
340 TaskManagerSettings
.ColumnSizeArray
[19] = 70;
341 TaskManagerSettings
.ColumnSizeArray
[20] = 70;
342 TaskManagerSettings
.ColumnSizeArray
[21] = 70;
343 TaskManagerSettings
.ColumnSizeArray
[22] = 70;
344 TaskManagerSettings
.ColumnSizeArray
[23] = 70;
345 TaskManagerSettings
.ColumnSizeArray
[24] = 70;
347 /* Get header order */
348 size
= SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMCOUNT
, 0, 0);
349 SendMessageW(hProcessPageHeaderCtrl
, HDM_GETORDERARRAY
, (WPARAM
) size
, (LPARAM
) &TaskManagerSettings
.ColumnOrderArray
);
351 /* Get visible columns */
352 for (i
=0; i
<SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMCOUNT
, 0, 0); i
++) {
353 memset(&hditem
, 0, sizeof(HDITEMW
));
355 hditem
.mask
= HDI_TEXT
|HDI_WIDTH
;
356 hditem
.pszText
= text
;
357 hditem
.cchTextMax
= 256;
359 SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMW
, i
, (LPARAM
) &hditem
);
361 if (strcmpW(text
, wszImageName
) == 0)
363 TaskManagerSettings
.Column_ImageName
= TRUE
;
364 TaskManagerSettings
.ColumnSizeArray
[0] = hditem
.cxy
;
366 if (strcmpW(text
, wszPID
) == 0)
368 TaskManagerSettings
.Column_PID
= TRUE
;
369 TaskManagerSettings
.ColumnSizeArray
[1] = hditem
.cxy
;
371 if (strcmpW(text
, wszUserName
) == 0)
373 TaskManagerSettings
.Column_UserName
= TRUE
;
374 TaskManagerSettings
.ColumnSizeArray
[2] = hditem
.cxy
;
376 if (strcmpW(text
, wszSessionID
) == 0)
378 TaskManagerSettings
.Column_SessionID
= TRUE
;
379 TaskManagerSettings
.ColumnSizeArray
[3] = hditem
.cxy
;
381 if (strcmpW(text
, wszCPU
) == 0)
383 TaskManagerSettings
.Column_CPUUsage
= TRUE
;
384 TaskManagerSettings
.ColumnSizeArray
[4] = hditem
.cxy
;
386 if (strcmpW(text
, wszCPUTime
) == 0)
388 TaskManagerSettings
.Column_CPUTime
= TRUE
;
389 TaskManagerSettings
.ColumnSizeArray
[5] = hditem
.cxy
;
391 if (strcmpW(text
, wszMemUsage
) == 0)
393 TaskManagerSettings
.Column_MemoryUsage
= TRUE
;
394 TaskManagerSettings
.ColumnSizeArray
[6] = hditem
.cxy
;
396 if (strcmpW(text
, wszPeakMemUsage
) == 0)
398 TaskManagerSettings
.Column_PeakMemoryUsage
= TRUE
;
399 TaskManagerSettings
.ColumnSizeArray
[7] = hditem
.cxy
;
401 if (strcmpW(text
, wszMemDelta
) == 0)
403 TaskManagerSettings
.Column_MemoryUsageDelta
= TRUE
;
404 TaskManagerSettings
.ColumnSizeArray
[8] = hditem
.cxy
;
406 if (strcmpW(text
, wszPageFaults
) == 0)
408 TaskManagerSettings
.Column_PageFaults
= TRUE
;
409 TaskManagerSettings
.ColumnSizeArray
[9] = hditem
.cxy
;
411 if (strcmpW(text
, wszPFDelta
) == 0)
413 TaskManagerSettings
.Column_PageFaultsDelta
= TRUE
;
414 TaskManagerSettings
.ColumnSizeArray
[10] = hditem
.cxy
;
416 if (strcmpW(text
, wszVMSize
) == 0)
418 TaskManagerSettings
.Column_VirtualMemorySize
= TRUE
;
419 TaskManagerSettings
.ColumnSizeArray
[11] = hditem
.cxy
;
421 if (strcmpW(text
, wszPagedPool
) == 0)
423 TaskManagerSettings
.Column_PagedPool
= TRUE
;
424 TaskManagerSettings
.ColumnSizeArray
[12] = hditem
.cxy
;
426 if (strcmpW(text
, wszNPPool
) == 0)
428 TaskManagerSettings
.Column_NonPagedPool
= TRUE
;
429 TaskManagerSettings
.ColumnSizeArray
[13] = hditem
.cxy
;
431 if (strcmpW(text
, wszBasePri
) == 0)
433 TaskManagerSettings
.Column_BasePriority
= TRUE
;
434 TaskManagerSettings
.ColumnSizeArray
[14] = hditem
.cxy
;
436 if (strcmpW(text
, wszHandles
) == 0)
438 TaskManagerSettings
.Column_HandleCount
= TRUE
;
439 TaskManagerSettings
.ColumnSizeArray
[15] = hditem
.cxy
;
441 if (strcmpW(text
, wszThreads
) == 0)
443 TaskManagerSettings
.Column_ThreadCount
= TRUE
;
444 TaskManagerSettings
.ColumnSizeArray
[16] = hditem
.cxy
;
446 if (strcmpW(text
, wszUSERObjects
) == 0)
448 TaskManagerSettings
.Column_USERObjects
= TRUE
;
449 TaskManagerSettings
.ColumnSizeArray
[17] = hditem
.cxy
;
451 if (strcmpW(text
, wszGDIObjects
) == 0)
453 TaskManagerSettings
.Column_GDIObjects
= TRUE
;
454 TaskManagerSettings
.ColumnSizeArray
[18] = hditem
.cxy
;
456 if (strcmpW(text
, wszIOReads
) == 0)
458 TaskManagerSettings
.Column_IOReads
= TRUE
;
459 TaskManagerSettings
.ColumnSizeArray
[19] = hditem
.cxy
;
461 if (strcmpW(text
, wszIOWrites
) == 0)
463 TaskManagerSettings
.Column_IOWrites
= TRUE
;
464 TaskManagerSettings
.ColumnSizeArray
[20] = hditem
.cxy
;
466 if (strcmpW(text
, wszIOOther
) == 0)
468 TaskManagerSettings
.Column_IOOther
= TRUE
;
469 TaskManagerSettings
.ColumnSizeArray
[21] = hditem
.cxy
;
471 if (strcmpW(text
, wszIOReadBytes
) == 0)
473 TaskManagerSettings
.Column_IOReadBytes
= TRUE
;
474 TaskManagerSettings
.ColumnSizeArray
[22] = hditem
.cxy
;
476 if (strcmpW(text
, wszIOWriteBytes
) == 0)
478 TaskManagerSettings
.Column_IOWriteBytes
= TRUE
;
479 TaskManagerSettings
.ColumnSizeArray
[23] = hditem
.cxy
;
481 if (strcmpW(text
, wszIOOtherBytes
) == 0)
483 TaskManagerSettings
.Column_IOOtherBytes
= TRUE
;
484 TaskManagerSettings
.ColumnSizeArray
[24] = hditem
.cxy
;
489 void ProcessPage_OnViewSelectColumns(void)
493 if (DialogBoxW(hInst
, MAKEINTRESOURCEW(IDD_COLUMNS_DIALOG
), hMainWnd
, ColumnsDialogWndProc
) == IDOK
)
495 for (i
=SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMCOUNT
, 0, 0)-1; i
>=0; i
--)
497 SendMessageW(hProcessPageListCtrl
, LVM_DELETECOLUMN
, 0, i
);
501 TaskManagerSettings
.ColumnOrderArray
[i
] = i
;
503 TaskManagerSettings
.ColumnSizeArray
[0] = 105;
504 TaskManagerSettings
.ColumnSizeArray
[1] = 50;
505 TaskManagerSettings
.ColumnSizeArray
[2] = 107;
506 TaskManagerSettings
.ColumnSizeArray
[3] = 70;
507 TaskManagerSettings
.ColumnSizeArray
[4] = 35;
508 TaskManagerSettings
.ColumnSizeArray
[5] = 70;
509 TaskManagerSettings
.ColumnSizeArray
[6] = 70;
510 TaskManagerSettings
.ColumnSizeArray
[7] = 100;
511 TaskManagerSettings
.ColumnSizeArray
[8] = 70;
512 TaskManagerSettings
.ColumnSizeArray
[9] = 70;
513 TaskManagerSettings
.ColumnSizeArray
[10] = 70;
514 TaskManagerSettings
.ColumnSizeArray
[11] = 70;
515 TaskManagerSettings
.ColumnSizeArray
[12] = 70;
516 TaskManagerSettings
.ColumnSizeArray
[13] = 70;
517 TaskManagerSettings
.ColumnSizeArray
[14] = 60;
518 TaskManagerSettings
.ColumnSizeArray
[15] = 60;
519 TaskManagerSettings
.ColumnSizeArray
[16] = 60;
520 TaskManagerSettings
.ColumnSizeArray
[17] = 60;
521 TaskManagerSettings
.ColumnSizeArray
[18] = 60;
522 TaskManagerSettings
.ColumnSizeArray
[19] = 70;
523 TaskManagerSettings
.ColumnSizeArray
[20] = 70;
524 TaskManagerSettings
.ColumnSizeArray
[21] = 70;
525 TaskManagerSettings
.ColumnSizeArray
[22] = 70;
526 TaskManagerSettings
.ColumnSizeArray
[23] = 70;
527 TaskManagerSettings
.ColumnSizeArray
[24] = 70;
533 void UpdateColumnDataHints(void)
539 for (Index
=0; Index
<(ULONG
)SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMCOUNT
, 0, 0); Index
++)
541 memset(&hditem
, 0, sizeof(HDITEMW
));
543 hditem
.mask
= HDI_TEXT
;
544 hditem
.pszText
= text
;
545 hditem
.cchTextMax
= 260;
547 SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMW
, Index
, (LPARAM
) &hditem
);
549 if (strcmpW(text
, wszImageName
) == 0)
550 ColumnDataHints
[Index
] = COLUMN_IMAGENAME
;
551 if (strcmpW(text
, wszPID
) == 0)
552 ColumnDataHints
[Index
] = COLUMN_PID
;
553 if (strcmpW(text
, wszUserName
) == 0)
554 ColumnDataHints
[Index
] = COLUMN_USERNAME
;
555 if (strcmpW(text
, wszSessionID
) == 0)
556 ColumnDataHints
[Index
] = COLUMN_SESSIONID
;
557 if (strcmpW(text
, wszCPU
) == 0)
558 ColumnDataHints
[Index
] = COLUMN_CPUUSAGE
;
559 if (strcmpW(text
, wszCPUTime
) == 0)
560 ColumnDataHints
[Index
] = COLUMN_CPUTIME
;
561 if (strcmpW(text
, wszMemUsage
) == 0)
562 ColumnDataHints
[Index
] = COLUMN_MEMORYUSAGE
;
563 if (strcmpW(text
, wszPeakMemUsage
) == 0)
564 ColumnDataHints
[Index
] = COLUMN_PEAKMEMORYUSAGE
;
565 if (strcmpW(text
, wszMemDelta
) == 0)
566 ColumnDataHints
[Index
] = COLUMN_MEMORYUSAGEDELTA
;
567 if (strcmpW(text
, wszPageFaults
) == 0)
568 ColumnDataHints
[Index
] = COLUMN_PAGEFAULTS
;
569 if (strcmpW(text
, wszPFDelta
) == 0)
570 ColumnDataHints
[Index
] = COLUMN_PAGEFAULTSDELTA
;
571 if (strcmpW(text
, wszVMSize
) == 0)
572 ColumnDataHints
[Index
] = COLUMN_VIRTUALMEMORYSIZE
;
573 if (strcmpW(text
, wszPagedPool
) == 0)
574 ColumnDataHints
[Index
] = COLUMN_PAGEDPOOL
;
575 if (strcmpW(text
, wszNPPool
) == 0)
576 ColumnDataHints
[Index
] = COLUMN_NONPAGEDPOOL
;
577 if (strcmpW(text
, wszBasePri
) == 0)
578 ColumnDataHints
[Index
] = COLUMN_BASEPRIORITY
;
579 if (strcmpW(text
, wszHandles
) == 0)
580 ColumnDataHints
[Index
] = COLUMN_HANDLECOUNT
;
581 if (strcmpW(text
, wszThreads
) == 0)
582 ColumnDataHints
[Index
] = COLUMN_THREADCOUNT
;
583 if (strcmpW(text
, wszUSERObjects
) == 0)
584 ColumnDataHints
[Index
] = COLUMN_USEROBJECTS
;
585 if (strcmpW(text
, wszGDIObjects
) == 0)
586 ColumnDataHints
[Index
] = COLUMN_GDIOBJECTS
;
587 if (strcmpW(text
, wszIOReads
) == 0)
588 ColumnDataHints
[Index
] = COLUMN_IOREADS
;
589 if (strcmpW(text
, wszIOWrites
) == 0)
590 ColumnDataHints
[Index
] = COLUMN_IOWRITES
;
591 if (strcmpW(text
, wszIOOther
) == 0)
592 ColumnDataHints
[Index
] = COLUMN_IOOTHER
;
593 if (strcmpW(text
, wszIOReadBytes
) == 0)
594 ColumnDataHints
[Index
] = COLUMN_IOREADBYTES
;
595 if (strcmpW(text
, wszIOWriteBytes
) == 0)
596 ColumnDataHints
[Index
] = COLUMN_IOWRITEBYTES
;
597 if (strcmpW(text
, wszIOOtherBytes
) == 0)
598 ColumnDataHints
[Index
] = COLUMN_IOOTHERBYTES
;