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 */
31 #include "wine/unicode.h"
35 UINT ColumnDataHints
[25];
37 /* Column Headers; Begin */
38 static WCHAR wszImageName
[255];
39 static WCHAR wszPID
[255];
40 static WCHAR wszUserName
[255];
41 static WCHAR wszSessionID
[255];
42 static WCHAR wszCPU
[255];
43 static WCHAR wszCPUTime
[255];
44 static WCHAR wszMemUsage
[255];
45 static WCHAR wszPeakMemUsage
[255];
46 static WCHAR wszMemDelta
[255];
47 static WCHAR wszPageFaults
[255];
48 static WCHAR wszPFDelta
[255];
49 static WCHAR wszVMSize
[255];
50 static WCHAR wszPagedPool
[255];
51 static WCHAR wszNPPool
[255];
52 static WCHAR wszBasePri
[255];
53 static WCHAR wszHandles
[255];
54 static WCHAR wszThreads
[255];
55 static WCHAR wszUSERObjects
[255];
56 static WCHAR wszGDIObjects
[255];
57 static WCHAR wszIOReads
[255];
58 static WCHAR wszIOWrites
[255];
59 static WCHAR wszIOOther
[255];
60 static WCHAR wszIOReadBytes
[255];
61 static WCHAR wszIOWriteBytes
[255];
62 static WCHAR wszIOOtherBytes
[255];
63 /* Column Headers; End */
65 static void load_column_headers(void)
67 LoadStringW(hInst
, IDS_IMAGENAME
, wszImageName
, sizeof(wszImageName
)/sizeof(WCHAR
));
68 LoadStringW(hInst
, IDS_PID
, wszPID
, sizeof(wszPID
)/sizeof(WCHAR
));
69 LoadStringW(hInst
, IDS_USERNAME
, wszUserName
, sizeof(wszUserName
)/sizeof(WCHAR
));
70 LoadStringW(hInst
, IDS_SESSIONID
, wszSessionID
, sizeof(wszSessionID
)/sizeof(WCHAR
));
71 LoadStringW(hInst
, IDS_CPUUSAGE
, wszCPU
, sizeof(wszCPU
)/sizeof(WCHAR
));
72 LoadStringW(hInst
, IDS_CPUTIME
, wszCPUTime
, sizeof(wszCPUTime
)/sizeof(WCHAR
));
73 LoadStringW(hInst
, IDS_MEMORYUSAGE
, wszMemUsage
, sizeof(wszMemUsage
)/sizeof(WCHAR
));
74 LoadStringW(hInst
, IDS_PEAKMEMORYUSAGE
, wszPeakMemUsage
, sizeof(wszPeakMemUsage
)/sizeof(WCHAR
));
75 LoadStringW(hInst
, IDS_MEMORYUSAGEDELTA
, wszMemDelta
, sizeof(wszMemDelta
)/sizeof(WCHAR
));
76 LoadStringW(hInst
, IDS_PAGEFAULTS
, wszPageFaults
, sizeof(wszPageFaults
)/sizeof(WCHAR
));
77 LoadStringW(hInst
, IDS_PAGEFAULTSDELTA
, wszPFDelta
, sizeof(wszPFDelta
)/sizeof(WCHAR
));
78 LoadStringW(hInst
, IDS_VIRTUALMEMORYSIZE
, wszVMSize
, sizeof(wszVMSize
)/sizeof(WCHAR
));
79 LoadStringW(hInst
, IDS_PAGEDPOOL
, wszPagedPool
, sizeof(wszPagedPool
)/sizeof(WCHAR
));
80 LoadStringW(hInst
, IDS_NONPAGEDPOOL
, wszNPPool
, sizeof(wszNPPool
)/sizeof(WCHAR
));
81 LoadStringW(hInst
, IDS_BASEPRIORITY
, wszBasePri
, sizeof(wszBasePri
)/sizeof(WCHAR
));
82 LoadStringW(hInst
, IDS_HANDLECOUNT
, wszHandles
, sizeof(wszHandles
)/sizeof(WCHAR
));
83 LoadStringW(hInst
, IDS_THREADCOUNT
, wszThreads
, sizeof(wszThreads
)/sizeof(WCHAR
));
84 LoadStringW(hInst
, IDS_USEROBJECTS
, wszUSERObjects
, sizeof(wszUSERObjects
)/sizeof(WCHAR
));
85 LoadStringW(hInst
, IDS_GDIOBJECTS
, wszGDIObjects
, sizeof(wszGDIObjects
)/sizeof(WCHAR
));
86 LoadStringW(hInst
, IDS_IOREADS
, wszIOReads
, sizeof(wszIOReads
)/sizeof(WCHAR
));
87 LoadStringW(hInst
, IDS_IOWRITES
, wszIOWrites
, sizeof(wszIOWrites
)/sizeof(WCHAR
));
88 LoadStringW(hInst
, IDS_IOOTHER
, wszIOOther
, sizeof(wszIOOther
)/sizeof(WCHAR
));
89 LoadStringW(hInst
, IDS_IOREADBYTES
, wszIOReadBytes
, sizeof(wszIOReadBytes
)/sizeof(WCHAR
));
90 LoadStringW(hInst
, IDS_IOWRITEBYTES
, wszIOWriteBytes
, sizeof(wszIOWriteBytes
)/sizeof(WCHAR
));
91 LoadStringW(hInst
, IDS_IOOTHERBYTES
, wszIOOtherBytes
, sizeof(wszIOOtherBytes
)/sizeof(WCHAR
));
94 static int InsertColumn(int nCol
, LPCWSTR lpszColumnHeading
, int nFormat
, int nWidth
, int nSubItem
)
98 column
.mask
= LVCF_TEXT
|LVCF_FMT
;
99 column
.pszText
= (LPWSTR
)lpszColumnHeading
;
100 column
.fmt
= nFormat
;
104 column
.mask
|= LVCF_WIDTH
;
110 column
.mask
|= LVCF_SUBITEM
;
111 column
.iSubItem
= nSubItem
;
114 return ListView_InsertColumnW(hProcessPageListCtrl
, nCol
, &column
);
117 void AddColumns(void)
121 load_column_headers();
123 if (TaskManagerSettings
.Column_ImageName
)
124 InsertColumn(0, wszImageName
, LVCFMT_LEFT
, TaskManagerSettings
.ColumnSizeArray
[0], -1);
125 if (TaskManagerSettings
.Column_PID
)
126 InsertColumn(1, wszPID
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[1], -1);
127 if (TaskManagerSettings
.Column_UserName
)
128 InsertColumn(2, wszUserName
, LVCFMT_LEFT
, TaskManagerSettings
.ColumnSizeArray
[2], -1);
129 if (TaskManagerSettings
.Column_SessionID
)
130 InsertColumn(3, wszSessionID
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[3], -1);
131 if (TaskManagerSettings
.Column_CPUUsage
)
132 InsertColumn(4, wszCPU
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[4], -1);
133 if (TaskManagerSettings
.Column_CPUTime
)
134 InsertColumn(5, wszCPUTime
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[5], -1);
135 if (TaskManagerSettings
.Column_MemoryUsage
)
136 InsertColumn(6, wszMemUsage
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[6], -1);
137 if (TaskManagerSettings
.Column_PeakMemoryUsage
)
138 InsertColumn(7, wszPeakMemUsage
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[7], -1);
139 if (TaskManagerSettings
.Column_MemoryUsageDelta
)
140 InsertColumn(8, wszMemDelta
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[8], -1);
141 if (TaskManagerSettings
.Column_PageFaults
)
142 InsertColumn(9, wszPageFaults
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[9], -1);
143 if (TaskManagerSettings
.Column_PageFaultsDelta
)
144 InsertColumn(10, wszPFDelta
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[10], -1);
145 if (TaskManagerSettings
.Column_VirtualMemorySize
)
146 InsertColumn(11, wszVMSize
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[11], -1);
147 if (TaskManagerSettings
.Column_PagedPool
)
148 InsertColumn(12, wszPagedPool
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[12], -1);
149 if (TaskManagerSettings
.Column_NonPagedPool
)
150 InsertColumn(13, wszNPPool
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[13], -1);
151 if (TaskManagerSettings
.Column_BasePriority
)
152 InsertColumn(14, wszBasePri
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[14], -1);
153 if (TaskManagerSettings
.Column_HandleCount
)
154 InsertColumn(15, wszHandles
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[15], -1);
155 if (TaskManagerSettings
.Column_ThreadCount
)
156 InsertColumn(16, wszThreads
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[16], -1);
157 if (TaskManagerSettings
.Column_USERObjects
)
158 InsertColumn(17, wszUSERObjects
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[17], -1);
159 if (TaskManagerSettings
.Column_GDIObjects
)
160 InsertColumn(18, wszGDIObjects
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[18], -1);
161 if (TaskManagerSettings
.Column_IOReads
)
162 InsertColumn(19, wszIOReads
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[19], -1);
163 if (TaskManagerSettings
.Column_IOWrites
)
164 InsertColumn(20, wszIOWrites
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[20], -1);
165 if (TaskManagerSettings
.Column_IOOther
)
166 InsertColumn(21, wszIOOther
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[21], -1);
167 if (TaskManagerSettings
.Column_IOReadBytes
)
168 InsertColumn(22, wszIOReadBytes
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[22], -1);
169 if (TaskManagerSettings
.Column_IOWriteBytes
)
170 InsertColumn(23, wszIOWriteBytes
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[23], -1);
171 if (TaskManagerSettings
.Column_IOOtherBytes
)
172 InsertColumn(24, wszIOOtherBytes
, LVCFMT_RIGHT
, TaskManagerSettings
.ColumnSizeArray
[24], -1);
174 size
= SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMCOUNT
, 0, 0);
175 SendMessageW(hProcessPageHeaderCtrl
, HDM_SETORDERARRAY
, (WPARAM
) size
, (LPARAM
) &TaskManagerSettings
.ColumnOrderArray
);
177 UpdateColumnDataHints();
180 static INT_PTR CALLBACK
ColumnsDialogWndProc(HWND hDlg
, UINT message
, WPARAM wParam
, LPARAM lParam
)
187 if (TaskManagerSettings
.Column_ImageName
)
188 SendMessageW(GetDlgItem(hDlg
, IDC_IMAGENAME
), BM_SETCHECK
, BST_CHECKED
, 0);
189 if (TaskManagerSettings
.Column_PID
)
190 SendMessageW(GetDlgItem(hDlg
, IDC_PID
), BM_SETCHECK
, BST_CHECKED
, 0);
191 if (TaskManagerSettings
.Column_UserName
)
192 SendMessageW(GetDlgItem(hDlg
, IDC_USERNAME
), BM_SETCHECK
, BST_CHECKED
, 0);
193 if (TaskManagerSettings
.Column_SessionID
)
194 SendMessageW(GetDlgItem(hDlg
, IDC_SESSIONID
), BM_SETCHECK
, BST_CHECKED
, 0);
195 if (TaskManagerSettings
.Column_CPUUsage
)
196 SendMessageW(GetDlgItem(hDlg
, IDC_CPUUSAGE
), BM_SETCHECK
, BST_CHECKED
, 0);
197 if (TaskManagerSettings
.Column_CPUTime
)
198 SendMessageW(GetDlgItem(hDlg
, IDC_CPUTIME
), BM_SETCHECK
, BST_CHECKED
, 0);
199 if (TaskManagerSettings
.Column_MemoryUsage
)
200 SendMessageW(GetDlgItem(hDlg
, IDC_MEMORYUSAGE
), BM_SETCHECK
, BST_CHECKED
, 0);
201 if (TaskManagerSettings
.Column_PeakMemoryUsage
)
202 SendMessageW(GetDlgItem(hDlg
, IDC_PEAKMEMORYUSAGE
), BM_SETCHECK
, BST_CHECKED
, 0);
203 if (TaskManagerSettings
.Column_MemoryUsageDelta
)
204 SendMessageW(GetDlgItem(hDlg
, IDC_MEMORYUSAGEDELTA
), BM_SETCHECK
, BST_CHECKED
, 0);
205 if (TaskManagerSettings
.Column_PageFaults
)
206 SendMessageW(GetDlgItem(hDlg
, IDC_PAGEFAULTS
), BM_SETCHECK
, BST_CHECKED
, 0);
207 if (TaskManagerSettings
.Column_PageFaultsDelta
)
208 SendMessageW(GetDlgItem(hDlg
, IDC_PAGEFAULTSDELTA
), BM_SETCHECK
, BST_CHECKED
, 0);
209 if (TaskManagerSettings
.Column_VirtualMemorySize
)
210 SendMessageW(GetDlgItem(hDlg
, IDC_VIRTUALMEMORYSIZE
), BM_SETCHECK
, BST_CHECKED
, 0);
211 if (TaskManagerSettings
.Column_PagedPool
)
212 SendMessageW(GetDlgItem(hDlg
, IDC_PAGEDPOOL
), BM_SETCHECK
, BST_CHECKED
, 0);
213 if (TaskManagerSettings
.Column_NonPagedPool
)
214 SendMessageW(GetDlgItem(hDlg
, IDC_NONPAGEDPOOL
), BM_SETCHECK
, BST_CHECKED
, 0);
215 if (TaskManagerSettings
.Column_BasePriority
)
216 SendMessageW(GetDlgItem(hDlg
, IDC_BASEPRIORITY
), BM_SETCHECK
, BST_CHECKED
, 0);
217 if (TaskManagerSettings
.Column_HandleCount
)
218 SendMessageW(GetDlgItem(hDlg
, IDC_HANDLECOUNT
), BM_SETCHECK
, BST_CHECKED
, 0);
219 if (TaskManagerSettings
.Column_ThreadCount
)
220 SendMessageW(GetDlgItem(hDlg
, IDC_THREADCOUNT
), BM_SETCHECK
, BST_CHECKED
, 0);
221 if (TaskManagerSettings
.Column_USERObjects
)
222 SendMessageW(GetDlgItem(hDlg
, IDC_USEROBJECTS
), BM_SETCHECK
, BST_CHECKED
, 0);
223 if (TaskManagerSettings
.Column_GDIObjects
)
224 SendMessageW(GetDlgItem(hDlg
, IDC_GDIOBJECTS
), BM_SETCHECK
, BST_CHECKED
, 0);
225 if (TaskManagerSettings
.Column_IOReads
)
226 SendMessageW(GetDlgItem(hDlg
, IDC_IOREADS
), BM_SETCHECK
, BST_CHECKED
, 0);
227 if (TaskManagerSettings
.Column_IOWrites
)
228 SendMessageW(GetDlgItem(hDlg
, IDC_IOWRITES
), BM_SETCHECK
, BST_CHECKED
, 0);
229 if (TaskManagerSettings
.Column_IOOther
)
230 SendMessageW(GetDlgItem(hDlg
, IDC_IOOTHER
), BM_SETCHECK
, BST_CHECKED
, 0);
231 if (TaskManagerSettings
.Column_IOReadBytes
)
232 SendMessageW(GetDlgItem(hDlg
, IDC_IOREADBYTES
), BM_SETCHECK
, BST_CHECKED
, 0);
233 if (TaskManagerSettings
.Column_IOWriteBytes
)
234 SendMessageW(GetDlgItem(hDlg
, IDC_IOWRITEBYTES
), BM_SETCHECK
, BST_CHECKED
, 0);
235 if (TaskManagerSettings
.Column_IOOtherBytes
)
236 SendMessageW(GetDlgItem(hDlg
, IDC_IOOTHERBYTES
), BM_SETCHECK
, BST_CHECKED
, 0);
242 if (LOWORD(wParam
) == IDCANCEL
)
244 EndDialog(hDlg
, LOWORD(wParam
));
248 if (LOWORD(wParam
) == IDOK
)
250 TaskManagerSettings
.Column_ImageName
= SendMessageW(GetDlgItem(hDlg
, IDC_IMAGENAME
), BM_GETCHECK
, 0, 0);
251 TaskManagerSettings
.Column_PID
= SendMessageW(GetDlgItem(hDlg
, IDC_PID
), BM_GETCHECK
, 0, 0);
252 TaskManagerSettings
.Column_UserName
= SendMessageW(GetDlgItem(hDlg
, IDC_USERNAME
), BM_GETCHECK
, 0, 0);
253 TaskManagerSettings
.Column_SessionID
= SendMessageW(GetDlgItem(hDlg
, IDC_SESSIONID
), BM_GETCHECK
, 0, 0);
254 TaskManagerSettings
.Column_CPUUsage
= SendMessageW(GetDlgItem(hDlg
, IDC_CPUUSAGE
), BM_GETCHECK
, 0, 0);
255 TaskManagerSettings
.Column_CPUTime
= SendMessageW(GetDlgItem(hDlg
, IDC_CPUTIME
), BM_GETCHECK
, 0, 0);
256 TaskManagerSettings
.Column_MemoryUsage
= SendMessageW(GetDlgItem(hDlg
, IDC_MEMORYUSAGE
), BM_GETCHECK
, 0, 0);
257 TaskManagerSettings
.Column_PeakMemoryUsage
= SendMessageW(GetDlgItem(hDlg
, IDC_PEAKMEMORYUSAGE
), BM_GETCHECK
, 0, 0);
258 TaskManagerSettings
.Column_MemoryUsageDelta
= SendMessageW(GetDlgItem(hDlg
, IDC_MEMORYUSAGEDELTA
), BM_GETCHECK
, 0, 0);
259 TaskManagerSettings
.Column_PageFaults
= SendMessageW(GetDlgItem(hDlg
, IDC_PAGEFAULTS
), BM_GETCHECK
, 0, 0);
260 TaskManagerSettings
.Column_PageFaultsDelta
= SendMessageW(GetDlgItem(hDlg
, IDC_PAGEFAULTSDELTA
), BM_GETCHECK
, 0, 0);
261 TaskManagerSettings
.Column_VirtualMemorySize
= SendMessageW(GetDlgItem(hDlg
, IDC_VIRTUALMEMORYSIZE
), BM_GETCHECK
, 0, 0);
262 TaskManagerSettings
.Column_PagedPool
= SendMessageW(GetDlgItem(hDlg
, IDC_PAGEDPOOL
), BM_GETCHECK
, 0, 0);
263 TaskManagerSettings
.Column_NonPagedPool
= SendMessageW(GetDlgItem(hDlg
, IDC_NONPAGEDPOOL
), BM_GETCHECK
, 0, 0);
264 TaskManagerSettings
.Column_BasePriority
= SendMessageW(GetDlgItem(hDlg
, IDC_BASEPRIORITY
), BM_GETCHECK
, 0, 0);
265 TaskManagerSettings
.Column_HandleCount
= SendMessageW(GetDlgItem(hDlg
, IDC_HANDLECOUNT
), BM_GETCHECK
, 0, 0);
266 TaskManagerSettings
.Column_ThreadCount
= SendMessageW(GetDlgItem(hDlg
, IDC_THREADCOUNT
), BM_GETCHECK
, 0, 0);
267 TaskManagerSettings
.Column_USERObjects
= SendMessageW(GetDlgItem(hDlg
, IDC_USEROBJECTS
), BM_GETCHECK
, 0, 0);
268 TaskManagerSettings
.Column_GDIObjects
= SendMessageW(GetDlgItem(hDlg
, IDC_GDIOBJECTS
), BM_GETCHECK
, 0, 0);
269 TaskManagerSettings
.Column_IOReads
= SendMessageW(GetDlgItem(hDlg
, IDC_IOREADS
), BM_GETCHECK
, 0, 0);
270 TaskManagerSettings
.Column_IOWrites
= SendMessageW(GetDlgItem(hDlg
, IDC_IOWRITES
), BM_GETCHECK
, 0, 0);
271 TaskManagerSettings
.Column_IOOther
= SendMessageW(GetDlgItem(hDlg
, IDC_IOOTHER
), BM_GETCHECK
, 0, 0);
272 TaskManagerSettings
.Column_IOReadBytes
= SendMessageW(GetDlgItem(hDlg
, IDC_IOREADBYTES
), BM_GETCHECK
, 0, 0);
273 TaskManagerSettings
.Column_IOWriteBytes
= SendMessageW(GetDlgItem(hDlg
, IDC_IOWRITEBYTES
), BM_GETCHECK
, 0, 0);
274 TaskManagerSettings
.Column_IOOtherBytes
= SendMessageW(GetDlgItem(hDlg
, IDC_IOOTHERBYTES
), BM_GETCHECK
, 0, 0);
276 EndDialog(hDlg
, LOWORD(wParam
));
286 void SaveColumnSettings(void)
293 /* Reset column data */
295 TaskManagerSettings
.ColumnOrderArray
[i
] = i
;
297 TaskManagerSettings
.Column_ImageName
= FALSE
;
298 TaskManagerSettings
.Column_PID
= FALSE
;
299 TaskManagerSettings
.Column_CPUUsage
= FALSE
;
300 TaskManagerSettings
.Column_CPUTime
= FALSE
;
301 TaskManagerSettings
.Column_MemoryUsage
= FALSE
;
302 TaskManagerSettings
.Column_MemoryUsageDelta
= FALSE
;
303 TaskManagerSettings
.Column_PeakMemoryUsage
= FALSE
;
304 TaskManagerSettings
.Column_PageFaults
= FALSE
;
305 TaskManagerSettings
.Column_USERObjects
= FALSE
;
306 TaskManagerSettings
.Column_IOReads
= FALSE
;
307 TaskManagerSettings
.Column_IOReadBytes
= FALSE
;
308 TaskManagerSettings
.Column_SessionID
= FALSE
;
309 TaskManagerSettings
.Column_UserName
= FALSE
;
310 TaskManagerSettings
.Column_PageFaultsDelta
= FALSE
;
311 TaskManagerSettings
.Column_VirtualMemorySize
= FALSE
;
312 TaskManagerSettings
.Column_PagedPool
= FALSE
;
313 TaskManagerSettings
.Column_NonPagedPool
= FALSE
;
314 TaskManagerSettings
.Column_BasePriority
= FALSE
;
315 TaskManagerSettings
.Column_HandleCount
= FALSE
;
316 TaskManagerSettings
.Column_ThreadCount
= FALSE
;
317 TaskManagerSettings
.Column_GDIObjects
= FALSE
;
318 TaskManagerSettings
.Column_IOWrites
= FALSE
;
319 TaskManagerSettings
.Column_IOWriteBytes
= FALSE
;
320 TaskManagerSettings
.Column_IOOther
= FALSE
;
321 TaskManagerSettings
.Column_IOOtherBytes
= FALSE
;
322 TaskManagerSettings
.ColumnSizeArray
[0] = 105;
323 TaskManagerSettings
.ColumnSizeArray
[1] = 50;
324 TaskManagerSettings
.ColumnSizeArray
[2] = 107;
325 TaskManagerSettings
.ColumnSizeArray
[3] = 70;
326 TaskManagerSettings
.ColumnSizeArray
[4] = 35;
327 TaskManagerSettings
.ColumnSizeArray
[5] = 70;
328 TaskManagerSettings
.ColumnSizeArray
[6] = 70;
329 TaskManagerSettings
.ColumnSizeArray
[7] = 100;
330 TaskManagerSettings
.ColumnSizeArray
[8] = 70;
331 TaskManagerSettings
.ColumnSizeArray
[9] = 70;
332 TaskManagerSettings
.ColumnSizeArray
[10] = 70;
333 TaskManagerSettings
.ColumnSizeArray
[11] = 70;
334 TaskManagerSettings
.ColumnSizeArray
[12] = 70;
335 TaskManagerSettings
.ColumnSizeArray
[13] = 70;
336 TaskManagerSettings
.ColumnSizeArray
[14] = 60;
337 TaskManagerSettings
.ColumnSizeArray
[15] = 60;
338 TaskManagerSettings
.ColumnSizeArray
[16] = 60;
339 TaskManagerSettings
.ColumnSizeArray
[17] = 60;
340 TaskManagerSettings
.ColumnSizeArray
[18] = 60;
341 TaskManagerSettings
.ColumnSizeArray
[19] = 70;
342 TaskManagerSettings
.ColumnSizeArray
[20] = 70;
343 TaskManagerSettings
.ColumnSizeArray
[21] = 70;
344 TaskManagerSettings
.ColumnSizeArray
[22] = 70;
345 TaskManagerSettings
.ColumnSizeArray
[23] = 70;
346 TaskManagerSettings
.ColumnSizeArray
[24] = 70;
348 /* Get header order */
349 size
= SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMCOUNT
, 0, 0);
350 SendMessageW(hProcessPageHeaderCtrl
, HDM_GETORDERARRAY
, (WPARAM
) size
, (LPARAM
) &TaskManagerSettings
.ColumnOrderArray
);
352 /* Get visible columns */
353 for (i
=0; i
<SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMCOUNT
, 0, 0); i
++) {
354 memset(&hditem
, 0, sizeof(HDITEMW
));
356 hditem
.mask
= HDI_TEXT
|HDI_WIDTH
;
357 hditem
.pszText
= text
;
358 hditem
.cchTextMax
= 256;
360 SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMW
, i
, (LPARAM
) &hditem
);
362 if (strcmpW(text
, wszImageName
) == 0)
364 TaskManagerSettings
.Column_ImageName
= TRUE
;
365 TaskManagerSettings
.ColumnSizeArray
[0] = hditem
.cxy
;
367 if (strcmpW(text
, wszPID
) == 0)
369 TaskManagerSettings
.Column_PID
= TRUE
;
370 TaskManagerSettings
.ColumnSizeArray
[1] = hditem
.cxy
;
372 if (strcmpW(text
, wszUserName
) == 0)
374 TaskManagerSettings
.Column_UserName
= TRUE
;
375 TaskManagerSettings
.ColumnSizeArray
[2] = hditem
.cxy
;
377 if (strcmpW(text
, wszSessionID
) == 0)
379 TaskManagerSettings
.Column_SessionID
= TRUE
;
380 TaskManagerSettings
.ColumnSizeArray
[3] = hditem
.cxy
;
382 if (strcmpW(text
, wszCPU
) == 0)
384 TaskManagerSettings
.Column_CPUUsage
= TRUE
;
385 TaskManagerSettings
.ColumnSizeArray
[4] = hditem
.cxy
;
387 if (strcmpW(text
, wszCPUTime
) == 0)
389 TaskManagerSettings
.Column_CPUTime
= TRUE
;
390 TaskManagerSettings
.ColumnSizeArray
[5] = hditem
.cxy
;
392 if (strcmpW(text
, wszMemUsage
) == 0)
394 TaskManagerSettings
.Column_MemoryUsage
= TRUE
;
395 TaskManagerSettings
.ColumnSizeArray
[6] = hditem
.cxy
;
397 if (strcmpW(text
, wszPeakMemUsage
) == 0)
399 TaskManagerSettings
.Column_PeakMemoryUsage
= TRUE
;
400 TaskManagerSettings
.ColumnSizeArray
[7] = hditem
.cxy
;
402 if (strcmpW(text
, wszMemDelta
) == 0)
404 TaskManagerSettings
.Column_MemoryUsageDelta
= TRUE
;
405 TaskManagerSettings
.ColumnSizeArray
[8] = hditem
.cxy
;
407 if (strcmpW(text
, wszPageFaults
) == 0)
409 TaskManagerSettings
.Column_PageFaults
= TRUE
;
410 TaskManagerSettings
.ColumnSizeArray
[9] = hditem
.cxy
;
412 if (strcmpW(text
, wszPFDelta
) == 0)
414 TaskManagerSettings
.Column_PageFaultsDelta
= TRUE
;
415 TaskManagerSettings
.ColumnSizeArray
[10] = hditem
.cxy
;
417 if (strcmpW(text
, wszVMSize
) == 0)
419 TaskManagerSettings
.Column_VirtualMemorySize
= TRUE
;
420 TaskManagerSettings
.ColumnSizeArray
[11] = hditem
.cxy
;
422 if (strcmpW(text
, wszPagedPool
) == 0)
424 TaskManagerSettings
.Column_PagedPool
= TRUE
;
425 TaskManagerSettings
.ColumnSizeArray
[12] = hditem
.cxy
;
427 if (strcmpW(text
, wszNPPool
) == 0)
429 TaskManagerSettings
.Column_NonPagedPool
= TRUE
;
430 TaskManagerSettings
.ColumnSizeArray
[13] = hditem
.cxy
;
432 if (strcmpW(text
, wszBasePri
) == 0)
434 TaskManagerSettings
.Column_BasePriority
= TRUE
;
435 TaskManagerSettings
.ColumnSizeArray
[14] = hditem
.cxy
;
437 if (strcmpW(text
, wszHandles
) == 0)
439 TaskManagerSettings
.Column_HandleCount
= TRUE
;
440 TaskManagerSettings
.ColumnSizeArray
[15] = hditem
.cxy
;
442 if (strcmpW(text
, wszThreads
) == 0)
444 TaskManagerSettings
.Column_ThreadCount
= TRUE
;
445 TaskManagerSettings
.ColumnSizeArray
[16] = hditem
.cxy
;
447 if (strcmpW(text
, wszUSERObjects
) == 0)
449 TaskManagerSettings
.Column_USERObjects
= TRUE
;
450 TaskManagerSettings
.ColumnSizeArray
[17] = hditem
.cxy
;
452 if (strcmpW(text
, wszGDIObjects
) == 0)
454 TaskManagerSettings
.Column_GDIObjects
= TRUE
;
455 TaskManagerSettings
.ColumnSizeArray
[18] = hditem
.cxy
;
457 if (strcmpW(text
, wszIOReads
) == 0)
459 TaskManagerSettings
.Column_IOReads
= TRUE
;
460 TaskManagerSettings
.ColumnSizeArray
[19] = hditem
.cxy
;
462 if (strcmpW(text
, wszIOWrites
) == 0)
464 TaskManagerSettings
.Column_IOWrites
= TRUE
;
465 TaskManagerSettings
.ColumnSizeArray
[20] = hditem
.cxy
;
467 if (strcmpW(text
, wszIOOther
) == 0)
469 TaskManagerSettings
.Column_IOOther
= TRUE
;
470 TaskManagerSettings
.ColumnSizeArray
[21] = hditem
.cxy
;
472 if (strcmpW(text
, wszIOReadBytes
) == 0)
474 TaskManagerSettings
.Column_IOReadBytes
= TRUE
;
475 TaskManagerSettings
.ColumnSizeArray
[22] = hditem
.cxy
;
477 if (strcmpW(text
, wszIOWriteBytes
) == 0)
479 TaskManagerSettings
.Column_IOWriteBytes
= TRUE
;
480 TaskManagerSettings
.ColumnSizeArray
[23] = hditem
.cxy
;
482 if (strcmpW(text
, wszIOOtherBytes
) == 0)
484 TaskManagerSettings
.Column_IOOtherBytes
= TRUE
;
485 TaskManagerSettings
.ColumnSizeArray
[24] = hditem
.cxy
;
490 void ProcessPage_OnViewSelectColumns(void)
494 if (DialogBoxW(hInst
, MAKEINTRESOURCEW(IDD_COLUMNS_DIALOG
), hMainWnd
, ColumnsDialogWndProc
) == IDOK
)
496 for (i
=Header_GetItemCount(hProcessPageHeaderCtrl
)-1; i
>=0; i
--)
498 ListView_DeleteColumn(hProcessPageListCtrl
, i
);
502 TaskManagerSettings
.ColumnOrderArray
[i
] = i
;
504 TaskManagerSettings
.ColumnSizeArray
[0] = 105;
505 TaskManagerSettings
.ColumnSizeArray
[1] = 50;
506 TaskManagerSettings
.ColumnSizeArray
[2] = 107;
507 TaskManagerSettings
.ColumnSizeArray
[3] = 70;
508 TaskManagerSettings
.ColumnSizeArray
[4] = 35;
509 TaskManagerSettings
.ColumnSizeArray
[5] = 70;
510 TaskManagerSettings
.ColumnSizeArray
[6] = 70;
511 TaskManagerSettings
.ColumnSizeArray
[7] = 100;
512 TaskManagerSettings
.ColumnSizeArray
[8] = 70;
513 TaskManagerSettings
.ColumnSizeArray
[9] = 70;
514 TaskManagerSettings
.ColumnSizeArray
[10] = 70;
515 TaskManagerSettings
.ColumnSizeArray
[11] = 70;
516 TaskManagerSettings
.ColumnSizeArray
[12] = 70;
517 TaskManagerSettings
.ColumnSizeArray
[13] = 70;
518 TaskManagerSettings
.ColumnSizeArray
[14] = 60;
519 TaskManagerSettings
.ColumnSizeArray
[15] = 60;
520 TaskManagerSettings
.ColumnSizeArray
[16] = 60;
521 TaskManagerSettings
.ColumnSizeArray
[17] = 60;
522 TaskManagerSettings
.ColumnSizeArray
[18] = 60;
523 TaskManagerSettings
.ColumnSizeArray
[19] = 70;
524 TaskManagerSettings
.ColumnSizeArray
[20] = 70;
525 TaskManagerSettings
.ColumnSizeArray
[21] = 70;
526 TaskManagerSettings
.ColumnSizeArray
[22] = 70;
527 TaskManagerSettings
.ColumnSizeArray
[23] = 70;
528 TaskManagerSettings
.ColumnSizeArray
[24] = 70;
534 void UpdateColumnDataHints(void)
540 for (Index
=0; Index
<(ULONG
)SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMCOUNT
, 0, 0); Index
++)
542 memset(&hditem
, 0, sizeof(HDITEMW
));
544 hditem
.mask
= HDI_TEXT
;
545 hditem
.pszText
= text
;
546 hditem
.cchTextMax
= 260;
548 SendMessageW(hProcessPageHeaderCtrl
, HDM_GETITEMW
, Index
, (LPARAM
) &hditem
);
550 if (strcmpW(text
, wszImageName
) == 0)
551 ColumnDataHints
[Index
] = COLUMN_IMAGENAME
;
552 if (strcmpW(text
, wszPID
) == 0)
553 ColumnDataHints
[Index
] = COLUMN_PID
;
554 if (strcmpW(text
, wszUserName
) == 0)
555 ColumnDataHints
[Index
] = COLUMN_USERNAME
;
556 if (strcmpW(text
, wszSessionID
) == 0)
557 ColumnDataHints
[Index
] = COLUMN_SESSIONID
;
558 if (strcmpW(text
, wszCPU
) == 0)
559 ColumnDataHints
[Index
] = COLUMN_CPUUSAGE
;
560 if (strcmpW(text
, wszCPUTime
) == 0)
561 ColumnDataHints
[Index
] = COLUMN_CPUTIME
;
562 if (strcmpW(text
, wszMemUsage
) == 0)
563 ColumnDataHints
[Index
] = COLUMN_MEMORYUSAGE
;
564 if (strcmpW(text
, wszPeakMemUsage
) == 0)
565 ColumnDataHints
[Index
] = COLUMN_PEAKMEMORYUSAGE
;
566 if (strcmpW(text
, wszMemDelta
) == 0)
567 ColumnDataHints
[Index
] = COLUMN_MEMORYUSAGEDELTA
;
568 if (strcmpW(text
, wszPageFaults
) == 0)
569 ColumnDataHints
[Index
] = COLUMN_PAGEFAULTS
;
570 if (strcmpW(text
, wszPFDelta
) == 0)
571 ColumnDataHints
[Index
] = COLUMN_PAGEFAULTSDELTA
;
572 if (strcmpW(text
, wszVMSize
) == 0)
573 ColumnDataHints
[Index
] = COLUMN_VIRTUALMEMORYSIZE
;
574 if (strcmpW(text
, wszPagedPool
) == 0)
575 ColumnDataHints
[Index
] = COLUMN_PAGEDPOOL
;
576 if (strcmpW(text
, wszNPPool
) == 0)
577 ColumnDataHints
[Index
] = COLUMN_NONPAGEDPOOL
;
578 if (strcmpW(text
, wszBasePri
) == 0)
579 ColumnDataHints
[Index
] = COLUMN_BASEPRIORITY
;
580 if (strcmpW(text
, wszHandles
) == 0)
581 ColumnDataHints
[Index
] = COLUMN_HANDLECOUNT
;
582 if (strcmpW(text
, wszThreads
) == 0)
583 ColumnDataHints
[Index
] = COLUMN_THREADCOUNT
;
584 if (strcmpW(text
, wszUSERObjects
) == 0)
585 ColumnDataHints
[Index
] = COLUMN_USEROBJECTS
;
586 if (strcmpW(text
, wszGDIObjects
) == 0)
587 ColumnDataHints
[Index
] = COLUMN_GDIOBJECTS
;
588 if (strcmpW(text
, wszIOReads
) == 0)
589 ColumnDataHints
[Index
] = COLUMN_IOREADS
;
590 if (strcmpW(text
, wszIOWrites
) == 0)
591 ColumnDataHints
[Index
] = COLUMN_IOWRITES
;
592 if (strcmpW(text
, wszIOOther
) == 0)
593 ColumnDataHints
[Index
] = COLUMN_IOOTHER
;
594 if (strcmpW(text
, wszIOReadBytes
) == 0)
595 ColumnDataHints
[Index
] = COLUMN_IOREADBYTES
;
596 if (strcmpW(text
, wszIOWriteBytes
) == 0)
597 ColumnDataHints
[Index
] = COLUMN_IOWRITEBYTES
;
598 if (strcmpW(text
, wszIOOtherBytes
) == 0)
599 ColumnDataHints
[Index
] = COLUMN_IOOTHERBYTES
;