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 #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
32 #include "wine/unicode.h"
36 UINT ColumnDataHints
[25];
38 /* Column Headers; Begin */
39 static const WCHAR wszImageName
[] = {'I','m','a','g','e',' ','N','a','m','e',0};
40 static const WCHAR wszPID
[] = {'P','I','D',0};
41 static const WCHAR wszUserName
[] = {'U','s','e','r','n','a','m','e',0};
42 static const WCHAR wszSessionID
[] = {'S','e','s','s','i','o','n',' ','I','D',0};
43 static const WCHAR wszCPU
[] = {'C','P','U',0};
44 static const WCHAR wszCPUTime
[] = {'C','P','U',' ','T','i','m','e',0};
45 static const WCHAR wszMemUsage
[] = {'M','e','m',' ','U','s','a','g','e',0};
46 static const WCHAR wszPeakMemUsage
[] = {'P','e','a','k',' ','M','e','m',' ','U','s','a','g','e',0};
47 static const WCHAR wszMemDelta
[] = {'M','e','m',' ','D','e','l','t','a',0};
48 static const WCHAR wszPageFaults
[] = {'P','a','g','e',' ','F','a','u','l','t','s',0};
49 static const WCHAR wszPFDelta
[] = {'P','F',' ','D','e','l','t','a',0};
50 static const WCHAR wszVMSize
[] = {'V','M',' ','S','i','z','e',0};
51 static const WCHAR wszPagedPool
[] = {'P','a','g','e','d',' ','P','o','o','l',0};
52 static const WCHAR wszNPPool
[] = {'N','P',' ','P','o','o','l',0};
53 static const WCHAR wszBasePri
[] = {'B','a','s','e',' ','P','r','i',0};
54 static const WCHAR wszHandles
[] = {'H','a','n','d','l','e','s',0};
55 static const WCHAR wszThreads
[] = {'T','h','r','e','a','d','s',0};
56 static const WCHAR wszUSERObjects
[] = {'U','S','E','R',' ','O','b','j','e','c','t','s',0};
57 static const WCHAR wszGDIObjects
[] = {'G','D','I',' ','O','b','j','e','c','t','s',0};
58 static const WCHAR wszIOReads
[] = {'I','/','O',' ','R','e','a','d','s',0};
59 static const WCHAR wszIOWrites
[] = {'I','/','O',' ','W','r','i','t','e','s',0};
60 static const WCHAR wszIOOther
[] = {'I','/','O',' ','O','t','h','e','r',0};
61 static const WCHAR wszIOReadBytes
[] = {'I','/','O',' ','R','e','a','d',' ','B','y','t','e','s',0};
62 static const WCHAR wszIOWriteBytes
[] = {'I','/','O',' ','W','r','i','t','e',' ','B','y','t','e','s',0};
63 static const WCHAR wszIOOtherBytes
[] = {'I','/','O',' ','O','t','h','e','r',' ','B','y','t','e','s',0};
64 /* Column Headers; End */
66 static int InsertColumn(int nCol
, LPCWSTR lpszColumnHeading
, int nFormat
, int nWidth
, int nSubItem
)
70 column
.mask
= LVCF_TEXT
|LVCF_FMT
;
71 column
.pszText
= (LPWSTR
)lpszColumnHeading
;
76 column
.mask
|= LVCF_WIDTH
;
82 column
.mask
|= LVCF_SUBITEM
;
83 column
.iSubItem
= nSubItem
;
86 return ListView_InsertColumnW(hProcessPageListCtrl
, nCol
, &column
);
93 if (TaskManagerSettings
.Column_ImageName
)
94 InsertColumn(0, wszImageName
, LVCFMT_LEFT
, TaskManagerSettings
.ColumnSizeArray
[0], -1);
95 if (TaskManagerSettings
.Column_PID
)
96 InsertColumn(1, wszPID
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[1], -1);
97 if (TaskManagerSettings
.Column_UserName
)
98 InsertColumn(2, wszUserName
, LVCFMT_LEFT
, TaskManagerSettings
.ColumnSizeArray
[2], -1);
99 if (TaskManagerSettings
.Column_SessionID
)
100 InsertColumn(3, wszSessionID
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[3], -1);
101 if (TaskManagerSettings
.Column_CPUUsage
)
102 InsertColumn(4, wszCPU
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[4], -1);
103 if (TaskManagerSettings
.Column_CPUTime
)
104 InsertColumn(5, wszCPUTime
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[5], -1);
105 if (TaskManagerSettings
.Column_MemoryUsage
)
106 InsertColumn(6, wszMemUsage
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[6], -1);
107 if (TaskManagerSettings
.Column_PeakMemoryUsage
)
108 InsertColumn(7, wszPeakMemUsage
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[7], -1);
109 if (TaskManagerSettings
.Column_MemoryUsageDelta
)
110 InsertColumn(8, wszMemDelta
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[8], -1);
111 if (TaskManagerSettings
.Column_PageFaults
)
112 InsertColumn(9, wszPageFaults
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[9], -1);
113 if (TaskManagerSettings
.Column_PageFaultsDelta
)
114 InsertColumn(10, wszPFDelta
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[10], -1);
115 if (TaskManagerSettings
.Column_VirtualMemorySize
)
116 InsertColumn(11, wszVMSize
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[11], -1);
117 if (TaskManagerSettings
.Column_PagedPool
)
118 InsertColumn(12, wszPagedPool
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[12], -1);
119 if (TaskManagerSettings
.Column_NonPagedPool
)
120 InsertColumn(13, wszNPPool
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[13], -1);
121 if (TaskManagerSettings
.Column_BasePriority
)
122 InsertColumn(14, wszBasePri
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[14], -1);
123 if (TaskManagerSettings
.Column_HandleCount
)
124 InsertColumn(15, wszHandles
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[15], -1);
125 if (TaskManagerSettings
.Column_ThreadCount
)
126 InsertColumn(16, wszThreads
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[16], -1);
127 if (TaskManagerSettings
.Column_USERObjects
)
128 InsertColumn(17, wszUSERObjects
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[17], -1);
129 if (TaskManagerSettings
.Column_GDIObjects
)
130 InsertColumn(18, wszGDIObjects
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[18], -1);
131 if (TaskManagerSettings
.Column_IOReads
)
132 InsertColumn(19, wszIOReads
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[19], -1);
133 if (TaskManagerSettings
.Column_IOWrites
)
134 InsertColumn(20, wszIOWrites
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[20], -1);
135 if (TaskManagerSettings
.Column_IOOther
)
136 InsertColumn(21, wszIOOther
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[21], -1);
137 if (TaskManagerSettings
.Column_IOReadBytes
)
138 InsertColumn(22, wszIOReadBytes
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[22], -1);
139 if (TaskManagerSettings
.Column_IOWriteBytes
)
140 InsertColumn(23, wszIOWriteBytes
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[23], -1);
141 if (TaskManagerSettings
.Column_IOOtherBytes
)
142 InsertColumn(24, wszIOOtherBytes
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[24], -1);
144 size
= SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMCOUNT
, 0, 0);
145 SendMessageW(hProcessPageHeaderCtrl
, HDM_SETORDERARRAY
, (WPARAM
) size
, (LPARAM
) &TaskManagerSettings
.ColumnOrderArray
);
147 UpdateColumnDataHints();
150 static INT_PTR CALLBACK
ColumnsDialogWndProc(HWND hDlg
, UINT message
, WPARAM wParam
, LPARAM lParam
)
157 if (TaskManagerSettings
.Column_ImageName
)
158 SendMessageW(GetDlgItem(hDlg
, IDC_IMAGENAME
), BM_SETCHECK
, BST_CHECKED
, 0);
159 if (TaskManagerSettings
.Column_PID
)
160 SendMessageW(GetDlgItem(hDlg
, IDC_PID
), BM_SETCHECK
, BST_CHECKED
, 0);
161 if (TaskManagerSettings
.Column_UserName
)
162 SendMessageW(GetDlgItem(hDlg
, IDC_USERNAME
), BM_SETCHECK
, BST_CHECKED
, 0);
163 if (TaskManagerSettings
.Column_SessionID
)
164 SendMessageW(GetDlgItem(hDlg
, IDC_SESSIONID
), BM_SETCHECK
, BST_CHECKED
, 0);
165 if (TaskManagerSettings
.Column_CPUUsage
)
166 SendMessageW(GetDlgItem(hDlg
, IDC_CPUUSAGE
), BM_SETCHECK
, BST_CHECKED
, 0);
167 if (TaskManagerSettings
.Column_CPUTime
)
168 SendMessageW(GetDlgItem(hDlg
, IDC_CPUTIME
), BM_SETCHECK
, BST_CHECKED
, 0);
169 if (TaskManagerSettings
.Column_MemoryUsage
)
170 SendMessageW(GetDlgItem(hDlg
, IDC_MEMORYUSAGE
), BM_SETCHECK
, BST_CHECKED
, 0);
171 if (TaskManagerSettings
.Column_PeakMemoryUsage
)
172 SendMessageW(GetDlgItem(hDlg
, IDC_PEAKMEMORYUSAGE
), BM_SETCHECK
, BST_CHECKED
, 0);
173 if (TaskManagerSettings
.Column_MemoryUsageDelta
)
174 SendMessageW(GetDlgItem(hDlg
, IDC_MEMORYUSAGEDELTA
), BM_SETCHECK
, BST_CHECKED
, 0);
175 if (TaskManagerSettings
.Column_PageFaults
)
176 SendMessageW(GetDlgItem(hDlg
, IDC_PAGEFAULTS
), BM_SETCHECK
, BST_CHECKED
, 0);
177 if (TaskManagerSettings
.Column_PageFaultsDelta
)
178 SendMessageW(GetDlgItem(hDlg
, IDC_PAGEFAULTSDELTA
), BM_SETCHECK
, BST_CHECKED
, 0);
179 if (TaskManagerSettings
.Column_VirtualMemorySize
)
180 SendMessageW(GetDlgItem(hDlg
, IDC_VIRTUALMEMORYSIZE
), BM_SETCHECK
, BST_CHECKED
, 0);
181 if (TaskManagerSettings
.Column_PagedPool
)
182 SendMessageW(GetDlgItem(hDlg
, IDC_PAGEDPOOL
), BM_SETCHECK
, BST_CHECKED
, 0);
183 if (TaskManagerSettings
.Column_NonPagedPool
)
184 SendMessageW(GetDlgItem(hDlg
, IDC_NONPAGEDPOOL
), BM_SETCHECK
, BST_CHECKED
, 0);
185 if (TaskManagerSettings
.Column_BasePriority
)
186 SendMessageW(GetDlgItem(hDlg
, IDC_BASEPRIORITY
), BM_SETCHECK
, BST_CHECKED
, 0);
187 if (TaskManagerSettings
.Column_HandleCount
)
188 SendMessageW(GetDlgItem(hDlg
, IDC_HANDLECOUNT
), BM_SETCHECK
, BST_CHECKED
, 0);
189 if (TaskManagerSettings
.Column_ThreadCount
)
190 SendMessageW(GetDlgItem(hDlg
, IDC_THREADCOUNT
), BM_SETCHECK
, BST_CHECKED
, 0);
191 if (TaskManagerSettings
.Column_USERObjects
)
192 SendMessageW(GetDlgItem(hDlg
, IDC_USEROBJECTS
), BM_SETCHECK
, BST_CHECKED
, 0);
193 if (TaskManagerSettings
.Column_GDIObjects
)
194 SendMessageW(GetDlgItem(hDlg
, IDC_GDIOBJECTS
), BM_SETCHECK
, BST_CHECKED
, 0);
195 if (TaskManagerSettings
.Column_IOReads
)
196 SendMessageW(GetDlgItem(hDlg
, IDC_IOREADS
), BM_SETCHECK
, BST_CHECKED
, 0);
197 if (TaskManagerSettings
.Column_IOWrites
)
198 SendMessageW(GetDlgItem(hDlg
, IDC_IOWRITES
), BM_SETCHECK
, BST_CHECKED
, 0);
199 if (TaskManagerSettings
.Column_IOOther
)
200 SendMessageW(GetDlgItem(hDlg
, IDC_IOOTHER
), BM_SETCHECK
, BST_CHECKED
, 0);
201 if (TaskManagerSettings
.Column_IOReadBytes
)
202 SendMessageW(GetDlgItem(hDlg
, IDC_IOREADBYTES
), BM_SETCHECK
, BST_CHECKED
, 0);
203 if (TaskManagerSettings
.Column_IOWriteBytes
)
204 SendMessageW(GetDlgItem(hDlg
, IDC_IOWRITEBYTES
), BM_SETCHECK
, BST_CHECKED
, 0);
205 if (TaskManagerSettings
.Column_IOOtherBytes
)
206 SendMessageW(GetDlgItem(hDlg
, IDC_IOOTHERBYTES
), BM_SETCHECK
, BST_CHECKED
, 0);
212 if (LOWORD(wParam
) == IDCANCEL
)
214 EndDialog(hDlg
, LOWORD(wParam
));
218 if (LOWORD(wParam
) == IDOK
)
220 TaskManagerSettings
.Column_ImageName
= SendMessageW(GetDlgItem(hDlg
, IDC_IMAGENAME
), BM_GETCHECK
, 0, 0);
221 TaskManagerSettings
.Column_PID
= SendMessageW(GetDlgItem(hDlg
, IDC_PID
), BM_GETCHECK
, 0, 0);
222 TaskManagerSettings
.Column_UserName
= SendMessageW(GetDlgItem(hDlg
, IDC_USERNAME
), BM_GETCHECK
, 0, 0);
223 TaskManagerSettings
.Column_SessionID
= SendMessageW(GetDlgItem(hDlg
, IDC_SESSIONID
), BM_GETCHECK
, 0, 0);
224 TaskManagerSettings
.Column_CPUUsage
= SendMessageW(GetDlgItem(hDlg
, IDC_CPUUSAGE
), BM_GETCHECK
, 0, 0);
225 TaskManagerSettings
.Column_CPUTime
= SendMessageW(GetDlgItem(hDlg
, IDC_CPUTIME
), BM_GETCHECK
, 0, 0);
226 TaskManagerSettings
.Column_MemoryUsage
= SendMessageW(GetDlgItem(hDlg
, IDC_MEMORYUSAGE
), BM_GETCHECK
, 0, 0);
227 TaskManagerSettings
.Column_PeakMemoryUsage
= SendMessageW(GetDlgItem(hDlg
, IDC_PEAKMEMORYUSAGE
), BM_GETCHECK
, 0, 0);
228 TaskManagerSettings
.Column_MemoryUsageDelta
= SendMessageW(GetDlgItem(hDlg
, IDC_MEMORYUSAGEDELTA
), BM_GETCHECK
, 0, 0);
229 TaskManagerSettings
.Column_PageFaults
= SendMessageW(GetDlgItem(hDlg
, IDC_PAGEFAULTS
), BM_GETCHECK
, 0, 0);
230 TaskManagerSettings
.Column_PageFaultsDelta
= SendMessageW(GetDlgItem(hDlg
, IDC_PAGEFAULTSDELTA
), BM_GETCHECK
, 0, 0);
231 TaskManagerSettings
.Column_VirtualMemorySize
= SendMessageW(GetDlgItem(hDlg
, IDC_VIRTUALMEMORYSIZE
), BM_GETCHECK
, 0, 0);
232 TaskManagerSettings
.Column_PagedPool
= SendMessageW(GetDlgItem(hDlg
, IDC_PAGEDPOOL
), BM_GETCHECK
, 0, 0);
233 TaskManagerSettings
.Column_NonPagedPool
= SendMessageW(GetDlgItem(hDlg
, IDC_NONPAGEDPOOL
), BM_GETCHECK
, 0, 0);
234 TaskManagerSettings
.Column_BasePriority
= SendMessageW(GetDlgItem(hDlg
, IDC_BASEPRIORITY
), BM_GETCHECK
, 0, 0);
235 TaskManagerSettings
.Column_HandleCount
= SendMessageW(GetDlgItem(hDlg
, IDC_HANDLECOUNT
), BM_GETCHECK
, 0, 0);
236 TaskManagerSettings
.Column_ThreadCount
= SendMessageW(GetDlgItem(hDlg
, IDC_THREADCOUNT
), BM_GETCHECK
, 0, 0);
237 TaskManagerSettings
.Column_USERObjects
= SendMessageW(GetDlgItem(hDlg
, IDC_USEROBJECTS
), BM_GETCHECK
, 0, 0);
238 TaskManagerSettings
.Column_GDIObjects
= SendMessageW(GetDlgItem(hDlg
, IDC_GDIOBJECTS
), BM_GETCHECK
, 0, 0);
239 TaskManagerSettings
.Column_IOReads
= SendMessageW(GetDlgItem(hDlg
, IDC_IOREADS
), BM_GETCHECK
, 0, 0);
240 TaskManagerSettings
.Column_IOWrites
= SendMessageW(GetDlgItem(hDlg
, IDC_IOWRITES
), BM_GETCHECK
, 0, 0);
241 TaskManagerSettings
.Column_IOOther
= SendMessageW(GetDlgItem(hDlg
, IDC_IOOTHER
), BM_GETCHECK
, 0, 0);
242 TaskManagerSettings
.Column_IOReadBytes
= SendMessageW(GetDlgItem(hDlg
, IDC_IOREADBYTES
), BM_GETCHECK
, 0, 0);
243 TaskManagerSettings
.Column_IOWriteBytes
= SendMessageW(GetDlgItem(hDlg
, IDC_IOWRITEBYTES
), BM_GETCHECK
, 0, 0);
244 TaskManagerSettings
.Column_IOOtherBytes
= SendMessageW(GetDlgItem(hDlg
, IDC_IOOTHERBYTES
), BM_GETCHECK
, 0, 0);
246 EndDialog(hDlg
, LOWORD(wParam
));
256 void SaveColumnSettings(void)
263 /* Reset column data */
265 TaskManagerSettings
.ColumnOrderArray
[i
] = i
;
267 TaskManagerSettings
.Column_ImageName
= FALSE
;
268 TaskManagerSettings
.Column_PID
= FALSE
;
269 TaskManagerSettings
.Column_CPUUsage
= FALSE
;
270 TaskManagerSettings
.Column_CPUTime
= FALSE
;
271 TaskManagerSettings
.Column_MemoryUsage
= FALSE
;
272 TaskManagerSettings
.Column_MemoryUsageDelta
= FALSE
;
273 TaskManagerSettings
.Column_PeakMemoryUsage
= FALSE
;
274 TaskManagerSettings
.Column_PageFaults
= FALSE
;
275 TaskManagerSettings
.Column_USERObjects
= FALSE
;
276 TaskManagerSettings
.Column_IOReads
= FALSE
;
277 TaskManagerSettings
.Column_IOReadBytes
= FALSE
;
278 TaskManagerSettings
.Column_SessionID
= FALSE
;
279 TaskManagerSettings
.Column_UserName
= FALSE
;
280 TaskManagerSettings
.Column_PageFaultsDelta
= FALSE
;
281 TaskManagerSettings
.Column_VirtualMemorySize
= FALSE
;
282 TaskManagerSettings
.Column_PagedPool
= FALSE
;
283 TaskManagerSettings
.Column_NonPagedPool
= FALSE
;
284 TaskManagerSettings
.Column_BasePriority
= FALSE
;
285 TaskManagerSettings
.Column_HandleCount
= FALSE
;
286 TaskManagerSettings
.Column_ThreadCount
= FALSE
;
287 TaskManagerSettings
.Column_GDIObjects
= FALSE
;
288 TaskManagerSettings
.Column_IOWrites
= FALSE
;
289 TaskManagerSettings
.Column_IOWriteBytes
= FALSE
;
290 TaskManagerSettings
.Column_IOOther
= FALSE
;
291 TaskManagerSettings
.Column_IOOtherBytes
= FALSE
;
292 TaskManagerSettings
.ColumnSizeArray
[0] = 105;
293 TaskManagerSettings
.ColumnSizeArray
[1] = 50;
294 TaskManagerSettings
.ColumnSizeArray
[2] = 107;
295 TaskManagerSettings
.ColumnSizeArray
[3] = 70;
296 TaskManagerSettings
.ColumnSizeArray
[4] = 35;
297 TaskManagerSettings
.ColumnSizeArray
[5] = 70;
298 TaskManagerSettings
.ColumnSizeArray
[6] = 70;
299 TaskManagerSettings
.ColumnSizeArray
[7] = 100;
300 TaskManagerSettings
.ColumnSizeArray
[8] = 70;
301 TaskManagerSettings
.ColumnSizeArray
[9] = 70;
302 TaskManagerSettings
.ColumnSizeArray
[10] = 70;
303 TaskManagerSettings
.ColumnSizeArray
[11] = 70;
304 TaskManagerSettings
.ColumnSizeArray
[12] = 70;
305 TaskManagerSettings
.ColumnSizeArray
[13] = 70;
306 TaskManagerSettings
.ColumnSizeArray
[14] = 60;
307 TaskManagerSettings
.ColumnSizeArray
[15] = 60;
308 TaskManagerSettings
.ColumnSizeArray
[16] = 60;
309 TaskManagerSettings
.ColumnSizeArray
[17] = 60;
310 TaskManagerSettings
.ColumnSizeArray
[18] = 60;
311 TaskManagerSettings
.ColumnSizeArray
[19] = 70;
312 TaskManagerSettings
.ColumnSizeArray
[20] = 70;
313 TaskManagerSettings
.ColumnSizeArray
[21] = 70;
314 TaskManagerSettings
.ColumnSizeArray
[22] = 70;
315 TaskManagerSettings
.ColumnSizeArray
[23] = 70;
316 TaskManagerSettings
.ColumnSizeArray
[24] = 70;
318 /* Get header order */
319 size
= SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMCOUNT
, 0, 0);
320 SendMessageW(hProcessPageHeaderCtrl
, HDM_GETORDERARRAY
, (WPARAM
) size
, (LPARAM
) &TaskManagerSettings
.ColumnOrderArray
);
322 /* Get visible columns */
323 for (i
=0; i
<SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMCOUNT
, 0, 0); i
++) {
324 memset(&hditem
, 0, sizeof(HDITEMW
));
326 hditem
.mask
= HDI_TEXT
|HDI_WIDTH
;
327 hditem
.pszText
= text
;
328 hditem
.cchTextMax
= 256;
330 SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMW
, i
, (LPARAM
) &hditem
);
332 if (strcmpW(text
, wszImageName
) == 0)
334 TaskManagerSettings
.Column_ImageName
= TRUE
;
335 TaskManagerSettings
.ColumnSizeArray
[0] = hditem
.cxy
;
337 if (strcmpW(text
, wszPID
) == 0)
339 TaskManagerSettings
.Column_PID
= TRUE
;
340 TaskManagerSettings
.ColumnSizeArray
[1] = hditem
.cxy
;
342 if (strcmpW(text
, wszUserName
) == 0)
344 TaskManagerSettings
.Column_UserName
= TRUE
;
345 TaskManagerSettings
.ColumnSizeArray
[2] = hditem
.cxy
;
347 if (strcmpW(text
, wszSessionID
) == 0)
349 TaskManagerSettings
.Column_SessionID
= TRUE
;
350 TaskManagerSettings
.ColumnSizeArray
[3] = hditem
.cxy
;
352 if (strcmpW(text
, wszCPU
) == 0)
354 TaskManagerSettings
.Column_CPUUsage
= TRUE
;
355 TaskManagerSettings
.ColumnSizeArray
[4] = hditem
.cxy
;
357 if (strcmpW(text
, wszCPUTime
) == 0)
359 TaskManagerSettings
.Column_CPUTime
= TRUE
;
360 TaskManagerSettings
.ColumnSizeArray
[5] = hditem
.cxy
;
362 if (strcmpW(text
, wszMemUsage
) == 0)
364 TaskManagerSettings
.Column_MemoryUsage
= TRUE
;
365 TaskManagerSettings
.ColumnSizeArray
[6] = hditem
.cxy
;
367 if (strcmpW(text
, wszPeakMemUsage
) == 0)
369 TaskManagerSettings
.Column_PeakMemoryUsage
= TRUE
;
370 TaskManagerSettings
.ColumnSizeArray
[7] = hditem
.cxy
;
372 if (strcmpW(text
, wszMemDelta
) == 0)
374 TaskManagerSettings
.Column_MemoryUsageDelta
= TRUE
;
375 TaskManagerSettings
.ColumnSizeArray
[8] = hditem
.cxy
;
377 if (strcmpW(text
, wszPageFaults
) == 0)
379 TaskManagerSettings
.Column_PageFaults
= TRUE
;
380 TaskManagerSettings
.ColumnSizeArray
[9] = hditem
.cxy
;
382 if (strcmpW(text
, wszPFDelta
) == 0)
384 TaskManagerSettings
.Column_PageFaultsDelta
= TRUE
;
385 TaskManagerSettings
.ColumnSizeArray
[10] = hditem
.cxy
;
387 if (strcmpW(text
, wszVMSize
) == 0)
389 TaskManagerSettings
.Column_VirtualMemorySize
= TRUE
;
390 TaskManagerSettings
.ColumnSizeArray
[11] = hditem
.cxy
;
392 if (strcmpW(text
, wszPagedPool
) == 0)
394 TaskManagerSettings
.Column_PagedPool
= TRUE
;
395 TaskManagerSettings
.ColumnSizeArray
[12] = hditem
.cxy
;
397 if (strcmpW(text
, wszNPPool
) == 0)
399 TaskManagerSettings
.Column_NonPagedPool
= TRUE
;
400 TaskManagerSettings
.ColumnSizeArray
[13] = hditem
.cxy
;
402 if (strcmpW(text
, wszBasePri
) == 0)
404 TaskManagerSettings
.Column_BasePriority
= TRUE
;
405 TaskManagerSettings
.ColumnSizeArray
[14] = hditem
.cxy
;
407 if (strcmpW(text
, wszHandles
) == 0)
409 TaskManagerSettings
.Column_HandleCount
= TRUE
;
410 TaskManagerSettings
.ColumnSizeArray
[15] = hditem
.cxy
;
412 if (strcmpW(text
, wszThreads
) == 0)
414 TaskManagerSettings
.Column_ThreadCount
= TRUE
;
415 TaskManagerSettings
.ColumnSizeArray
[16] = hditem
.cxy
;
417 if (strcmpW(text
, wszUSERObjects
) == 0)
419 TaskManagerSettings
.Column_USERObjects
= TRUE
;
420 TaskManagerSettings
.ColumnSizeArray
[17] = hditem
.cxy
;
422 if (strcmpW(text
, wszGDIObjects
) == 0)
424 TaskManagerSettings
.Column_GDIObjects
= TRUE
;
425 TaskManagerSettings
.ColumnSizeArray
[18] = hditem
.cxy
;
427 if (strcmpW(text
, wszIOReads
) == 0)
429 TaskManagerSettings
.Column_IOReads
= TRUE
;
430 TaskManagerSettings
.ColumnSizeArray
[19] = hditem
.cxy
;
432 if (strcmpW(text
, wszIOWrites
) == 0)
434 TaskManagerSettings
.Column_IOWrites
= TRUE
;
435 TaskManagerSettings
.ColumnSizeArray
[20] = hditem
.cxy
;
437 if (strcmpW(text
, wszIOOther
) == 0)
439 TaskManagerSettings
.Column_IOOther
= TRUE
;
440 TaskManagerSettings
.ColumnSizeArray
[21] = hditem
.cxy
;
442 if (strcmpW(text
, wszIOReadBytes
) == 0)
444 TaskManagerSettings
.Column_IOReadBytes
= TRUE
;
445 TaskManagerSettings
.ColumnSizeArray
[22] = hditem
.cxy
;
447 if (strcmpW(text
, wszIOWriteBytes
) == 0)
449 TaskManagerSettings
.Column_IOWriteBytes
= TRUE
;
450 TaskManagerSettings
.ColumnSizeArray
[23] = hditem
.cxy
;
452 if (strcmpW(text
, wszIOOtherBytes
) == 0)
454 TaskManagerSettings
.Column_IOOtherBytes
= TRUE
;
455 TaskManagerSettings
.ColumnSizeArray
[24] = hditem
.cxy
;
460 void ProcessPage_OnViewSelectColumns(void)
464 if (DialogBoxW(hInst
, MAKEINTRESOURCEW(IDD_COLUMNS_DIALOG
), hMainWnd
, ColumnsDialogWndProc
) == IDOK
)
466 for (i
=Header_GetItemCount(hProcessPageHeaderCtrl
)-1; i
>=0; i
--)
468 ListView_DeleteColumn(hProcessPageListCtrl
, i
);
472 TaskManagerSettings
.ColumnOrderArray
[i
] = i
;
474 TaskManagerSettings
.ColumnSizeArray
[0] = 105;
475 TaskManagerSettings
.ColumnSizeArray
[1] = 50;
476 TaskManagerSettings
.ColumnSizeArray
[2] = 107;
477 TaskManagerSettings
.ColumnSizeArray
[3] = 70;
478 TaskManagerSettings
.ColumnSizeArray
[4] = 35;
479 TaskManagerSettings
.ColumnSizeArray
[5] = 70;
480 TaskManagerSettings
.ColumnSizeArray
[6] = 70;
481 TaskManagerSettings
.ColumnSizeArray
[7] = 100;
482 TaskManagerSettings
.ColumnSizeArray
[8] = 70;
483 TaskManagerSettings
.ColumnSizeArray
[9] = 70;
484 TaskManagerSettings
.ColumnSizeArray
[10] = 70;
485 TaskManagerSettings
.ColumnSizeArray
[11] = 70;
486 TaskManagerSettings
.ColumnSizeArray
[12] = 70;
487 TaskManagerSettings
.ColumnSizeArray
[13] = 70;
488 TaskManagerSettings
.ColumnSizeArray
[14] = 60;
489 TaskManagerSettings
.ColumnSizeArray
[15] = 60;
490 TaskManagerSettings
.ColumnSizeArray
[16] = 60;
491 TaskManagerSettings
.ColumnSizeArray
[17] = 60;
492 TaskManagerSettings
.ColumnSizeArray
[18] = 60;
493 TaskManagerSettings
.ColumnSizeArray
[19] = 70;
494 TaskManagerSettings
.ColumnSizeArray
[20] = 70;
495 TaskManagerSettings
.ColumnSizeArray
[21] = 70;
496 TaskManagerSettings
.ColumnSizeArray
[22] = 70;
497 TaskManagerSettings
.ColumnSizeArray
[23] = 70;
498 TaskManagerSettings
.ColumnSizeArray
[24] = 70;
504 void UpdateColumnDataHints(void)
510 for (Index
=0; Index
<(ULONG
)SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMCOUNT
, 0, 0); Index
++)
512 memset(&hditem
, 0, sizeof(HDITEMW
));
514 hditem
.mask
= HDI_TEXT
;
515 hditem
.pszText
= text
;
516 hditem
.cchTextMax
= 260;
518 SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMW
, Index
, (LPARAM
) &hditem
);
520 if (strcmpW(text
, wszImageName
) == 0)
521 ColumnDataHints
[Index
] = COLUMN_IMAGENAME
;
522 if (strcmpW(text
, wszPID
) == 0)
523 ColumnDataHints
[Index
] = COLUMN_PID
;
524 if (strcmpW(text
, wszUserName
) == 0)
525 ColumnDataHints
[Index
] = COLUMN_USERNAME
;
526 if (strcmpW(text
, wszSessionID
) == 0)
527 ColumnDataHints
[Index
] = COLUMN_SESSIONID
;
528 if (strcmpW(text
, wszCPU
) == 0)
529 ColumnDataHints
[Index
] = COLUMN_CPUUSAGE
;
530 if (strcmpW(text
, wszCPUTime
) == 0)
531 ColumnDataHints
[Index
] = COLUMN_CPUTIME
;
532 if (strcmpW(text
, wszMemUsage
) == 0)
533 ColumnDataHints
[Index
] = COLUMN_MEMORYUSAGE
;
534 if (strcmpW(text
, wszPeakMemUsage
) == 0)
535 ColumnDataHints
[Index
] = COLUMN_PEAKMEMORYUSAGE
;
536 if (strcmpW(text
, wszMemDelta
) == 0)
537 ColumnDataHints
[Index
] = COLUMN_MEMORYUSAGEDELTA
;
538 if (strcmpW(text
, wszPageFaults
) == 0)
539 ColumnDataHints
[Index
] = COLUMN_PAGEFAULTS
;
540 if (strcmpW(text
, wszPFDelta
) == 0)
541 ColumnDataHints
[Index
] = COLUMN_PAGEFAULTSDELTA
;
542 if (strcmpW(text
, wszVMSize
) == 0)
543 ColumnDataHints
[Index
] = COLUMN_VIRTUALMEMORYSIZE
;
544 if (strcmpW(text
, wszPagedPool
) == 0)
545 ColumnDataHints
[Index
] = COLUMN_PAGEDPOOL
;
546 if (strcmpW(text
, wszNPPool
) == 0)
547 ColumnDataHints
[Index
] = COLUMN_NONPAGEDPOOL
;
548 if (strcmpW(text
, wszBasePri
) == 0)
549 ColumnDataHints
[Index
] = COLUMN_BASEPRIORITY
;
550 if (strcmpW(text
, wszHandles
) == 0)
551 ColumnDataHints
[Index
] = COLUMN_HANDLECOUNT
;
552 if (strcmpW(text
, wszThreads
) == 0)
553 ColumnDataHints
[Index
] = COLUMN_THREADCOUNT
;
554 if (strcmpW(text
, wszUSERObjects
) == 0)
555 ColumnDataHints
[Index
] = COLUMN_USEROBJECTS
;
556 if (strcmpW(text
, wszGDIObjects
) == 0)
557 ColumnDataHints
[Index
] = COLUMN_GDIOBJECTS
;
558 if (strcmpW(text
, wszIOReads
) == 0)
559 ColumnDataHints
[Index
] = COLUMN_IOREADS
;
560 if (strcmpW(text
, wszIOWrites
) == 0)
561 ColumnDataHints
[Index
] = COLUMN_IOWRITES
;
562 if (strcmpW(text
, wszIOOther
) == 0)
563 ColumnDataHints
[Index
] = COLUMN_IOOTHER
;
564 if (strcmpW(text
, wszIOReadBytes
) == 0)
565 ColumnDataHints
[Index
] = COLUMN_IOREADBYTES
;
566 if (strcmpW(text
, wszIOWriteBytes
) == 0)
567 ColumnDataHints
[Index
] = COLUMN_IOWRITEBYTES
;
568 if (strcmpW(text
, wszIOOtherBytes
) == 0)
569 ColumnDataHints
[Index
] = COLUMN_IOOTHERBYTES
;