Release 2.3.
[wine.git] / programs / taskmgr / procpage.c
blobbeccd86e5fc785fb7dab8d9dd9a19a5ec42e1153
1 /*
2 * ReactOS Task Manager
4 * procpage.c
6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include <ctype.h>
24 #include <stdio.h>
25 #include <stdlib.h>
27 #include <windows.h>
28 #include <commctrl.h>
29 #include <winnt.h>
31 #include "taskmgr.h"
32 #include "perfdata.h"
33 #include "column.h"
35 HWND hProcessPage; /* Process List Property Page */
37 HWND hProcessPageListCtrl; /* Process ListCtrl Window */
38 HWND hProcessPageHeaderCtrl; /* Process Header Control */
39 HWND hProcessPageEndProcessButton; /* Process End Process button */
40 HWND hProcessPageShowAllProcessesButton;/* Process Show All Processes checkbox */
42 static int nProcessPageWidth;
43 static int nProcessPageHeight;
45 static HANDLE hProcessPageEvent = NULL; /* When this event becomes signaled then we refresh the process list */
48 static void CommaSeparateNumberString(LPWSTR strNumber, int nMaxCount)
50 WCHAR temp[260];
51 UINT i, j, k;
52 int len = lstrlenW(strNumber);
54 for (i=0; i < len % 3; i++)
55 temp[i] = strNumber[i];
56 for (k=0,j=i; i < len; i++,j++,k++) {
57 if ((k % 3 == 0) && (j > 0))
58 temp[j++] = ',';
59 temp[j] = strNumber[i];
61 temp[j++] = 0;
62 memcpy(strNumber, temp, min(nMaxCount, j) * sizeof(WCHAR));
65 static void ProcessPageShowContextMenu(DWORD dwProcessId)
67 HMENU hMenu;
68 HMENU hSubMenu;
69 HMENU hPriorityMenu;
70 POINT pt;
71 SYSTEM_INFO si;
72 HANDLE hProcess;
73 DWORD dwProcessPriorityClass;
74 WCHAR strDebugger[260];
75 DWORD dwDebuggerSize;
76 HKEY hKey;
77 UINT Idx;
78 static const WCHAR wszAeDebugRegPath[] = {
79 'S','o','f','t','w','a','r','e','\\',
80 'M','i','c','r','o','s','o','f','t','\\',
81 'W','i','n','d','o','w','s',' ','N','T','\\',
82 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
83 'A','e','D','e','b','u','g',0};
85 memset(&si, 0, sizeof(SYSTEM_INFO));
87 GetCursorPos(&pt);
88 GetSystemInfo(&si);
90 hMenu = LoadMenuW(hInst, MAKEINTRESOURCEW(IDR_PROCESS_PAGE_CONTEXT));
91 hSubMenu = GetSubMenu(hMenu, 0);
92 hPriorityMenu = GetSubMenu(hSubMenu, 4);
94 hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dwProcessId);
95 dwProcessPriorityClass = GetPriorityClass(hProcess);
96 CloseHandle(hProcess);
98 if (si.dwNumberOfProcessors < 2)
99 RemoveMenu(hSubMenu, ID_PROCESS_PAGE_SETAFFINITY, MF_BYCOMMAND);
101 if (!AreDebugChannelsSupported())
102 RemoveMenu(hSubMenu, ID_PROCESS_PAGE_DEBUGCHANNELS, MF_BYCOMMAND);
104 switch (dwProcessPriorityClass) {
105 case REALTIME_PRIORITY_CLASS:
106 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, MF_BYCOMMAND);
107 break;
108 case HIGH_PRIORITY_CLASS:
109 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_HIGH, MF_BYCOMMAND);
110 break;
111 case ABOVE_NORMAL_PRIORITY_CLASS:
112 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL, MF_BYCOMMAND);
113 break;
114 case NORMAL_PRIORITY_CLASS:
115 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_NORMAL, MF_BYCOMMAND);
116 break;
117 case BELOW_NORMAL_PRIORITY_CLASS:
118 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL, MF_BYCOMMAND);
119 break;
120 case IDLE_PRIORITY_CLASS:
121 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_LOW, MF_BYCOMMAND);
122 break;
125 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszAeDebugRegPath, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
127 static const WCHAR wszDebugger[] = {'D','e','b','u','g','g','e','r',0};
128 dwDebuggerSize = 260;
129 if (RegQueryValueExW(hKey, wszDebugger, NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) == ERROR_SUCCESS)
131 static const WCHAR wszDRWTSN32[] = {'D','R','W','T','S','N','3','2',0};
132 for (Idx=0; Idx < lstrlenW(strDebugger); Idx++)
133 strDebugger[Idx] = toupper(strDebugger[Idx]);
135 if (wcsstr(strDebugger, wszDRWTSN32))
136 EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
138 else
139 EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
141 RegCloseKey(hKey);
142 } else {
143 EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
145 TrackPopupMenu(hSubMenu, TPM_LEFTALIGN|TPM_TOPALIGN|TPM_LEFTBUTTON, pt.x, pt.y, 0, hMainWnd, NULL);
146 DestroyMenu(hMenu);
149 static void ProcessPageOnNotify(LPARAM lParam)
151 LPNMHDR pnmh;
152 NMLVDISPINFOW* pnmdi;
153 LVITEMW lvitem;
154 ULONG Index, Count;
155 ULONG ColumnIndex;
156 IO_COUNTERS iocounters;
157 TIME time;
158 static const WCHAR wszFmtD[] = {'%','d',0};
159 static const WCHAR wszFmt02D[] = {'%','0','2','d',0};
160 static const WCHAR wszUnitK[] = {' ','K',0};
162 pnmh = (LPNMHDR) lParam;
163 pnmdi = (NMLVDISPINFOW*) lParam;
165 if (pnmh->hwndFrom == hProcessPageListCtrl)
167 switch (pnmh->code)
169 case LVN_GETDISPINFOW:
171 if (!(pnmdi->item.mask & LVIF_TEXT))
172 break;
174 ColumnIndex = pnmdi->item.iSubItem;
175 Index = pnmdi->item.iItem;
177 if (ColumnDataHints[ColumnIndex] == COLUMN_IMAGENAME)
178 PerfDataGetImageName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax);
179 if (ColumnDataHints[ColumnIndex] == COLUMN_PID)
180 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetProcessId(Index));
181 if (ColumnDataHints[ColumnIndex] == COLUMN_USERNAME)
182 PerfDataGetUserName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax);
183 if (ColumnDataHints[ColumnIndex] == COLUMN_SESSIONID)
184 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetSessionId(Index));
185 if (ColumnDataHints[ColumnIndex] == COLUMN_CPUUSAGE)
186 wsprintfW(pnmdi->item.pszText, wszFmt02D, PerfDataGetCPUUsage(Index));
187 if (ColumnDataHints[ColumnIndex] == COLUMN_CPUTIME)
189 DWORD dwHours;
190 DWORD dwMinutes;
191 DWORD dwSeconds;
192 ULONGLONG secs;
193 static const WCHAR timefmt[] = {'%','d',':','%','0','2','d',':','%','0','2','d',0};
195 time = PerfDataGetCPUTime(Index);
196 secs = time.QuadPart / 10000000;
197 dwHours = secs / 3600;
198 dwMinutes = (secs % 3600) / 60;
199 dwSeconds = (secs % 3600) % 60;
200 wsprintfW(pnmdi->item.pszText, timefmt, dwHours, dwMinutes, dwSeconds);
202 if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGE)
204 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetWorkingSetSizeBytes(Index) / 1024);
205 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
206 wcscat(pnmdi->item.pszText, wszUnitK);
208 if (ColumnDataHints[ColumnIndex] == COLUMN_PEAKMEMORYUSAGE)
210 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetPeakWorkingSetSizeBytes(Index) / 1024);
211 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
212 wcscat(pnmdi->item.pszText, wszUnitK);
214 if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGEDELTA)
216 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetWorkingSetSizeDelta(Index) / 1024);
217 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
218 wcscat(pnmdi->item.pszText, wszUnitK);
220 if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTS)
222 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetPageFaultCount(Index));
223 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
225 if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTSDELTA)
227 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetPageFaultCountDelta(Index));
228 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
230 if (ColumnDataHints[ColumnIndex] == COLUMN_VIRTUALMEMORYSIZE)
232 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetVirtualMemorySizeBytes(Index) / 1024);
233 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
234 wcscat(pnmdi->item.pszText, wszUnitK);
236 if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEDPOOL)
238 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetPagedPoolUsagePages(Index) / 1024);
239 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
240 wcscat(pnmdi->item.pszText, wszUnitK);
242 if (ColumnDataHints[ColumnIndex] == COLUMN_NONPAGEDPOOL)
244 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetNonPagedPoolUsagePages(Index) / 1024);
245 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
246 wcscat(pnmdi->item.pszText, wszUnitK);
248 if (ColumnDataHints[ColumnIndex] == COLUMN_BASEPRIORITY)
249 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetBasePriority(Index));
250 if (ColumnDataHints[ColumnIndex] == COLUMN_HANDLECOUNT)
252 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetHandleCount(Index));
253 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
255 if (ColumnDataHints[ColumnIndex] == COLUMN_THREADCOUNT)
257 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetThreadCount(Index));
258 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
260 if (ColumnDataHints[ColumnIndex] == COLUMN_USEROBJECTS)
262 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetUSERObjectCount(Index));
263 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
265 if (ColumnDataHints[ColumnIndex] == COLUMN_GDIOBJECTS)
267 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetGDIObjectCount(Index));
268 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
270 if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADS)
272 PerfDataGetIOCounters(Index, &iocounters);
273 /* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.ReadOperationCount); */
274 _ui64tow(iocounters.ReadOperationCount, pnmdi->item.pszText, 10);
275 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
277 if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITES)
279 PerfDataGetIOCounters(Index, &iocounters);
280 /* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.WriteOperationCount); */
281 _ui64tow(iocounters.WriteOperationCount, pnmdi->item.pszText, 10);
282 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
284 if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHER)
286 PerfDataGetIOCounters(Index, &iocounters);
287 /* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.OtherOperationCount); */
288 _ui64tow(iocounters.OtherOperationCount, pnmdi->item.pszText, 10);
289 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
291 if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADBYTES)
293 PerfDataGetIOCounters(Index, &iocounters);
294 /* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.ReadTransferCount); */
295 _ui64tow(iocounters.ReadTransferCount, pnmdi->item.pszText, 10);
296 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
298 if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITEBYTES)
300 PerfDataGetIOCounters(Index, &iocounters);
301 /* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.WriteTransferCount); */
302 _ui64tow(iocounters.WriteTransferCount, pnmdi->item.pszText, 10);
303 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
305 if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHERBYTES)
307 PerfDataGetIOCounters(Index, &iocounters);
308 /* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.OtherTransferCount); */
309 _ui64tow(iocounters.OtherTransferCount, pnmdi->item.pszText, 10);
310 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
313 break;
315 case NM_RCLICK:
316 Count = SendMessageW(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
317 for (Index=0; Index<Count; Index++)
319 lvitem.mask = LVIF_STATE;
320 lvitem.stateMask = LVIS_SELECTED;
321 lvitem.iItem = Index;
322 lvitem.iSubItem = 0;
324 SendMessageW(hProcessPageListCtrl, LVM_GETITEMW, 0, (LPARAM) &lvitem);
326 if (lvitem.state & LVIS_SELECTED)
327 break;
330 if ((SendMessageW(hProcessPageListCtrl, LVM_GETSELECTEDCOUNT, 0, 0) == 1) &&
331 (PerfDataGetProcessId(Index) != 0))
333 ProcessPageShowContextMenu(PerfDataGetProcessId(Index));
336 break;
340 else if (pnmh->hwndFrom == hProcessPageHeaderCtrl)
342 switch (pnmh->code)
344 case HDN_ITEMCLICKW:
347 * FIXME: Fix the column sorting
349 *ListView_SortItems(hApplicationPageListCtrl, ApplicationPageCompareFunc, NULL);
350 *bSortAscending = !bSortAscending;
353 break;
355 case HDN_ITEMCHANGEDW:
357 UpdateColumnDataHints();
359 break;
361 case HDN_ENDDRAG:
363 UpdateColumnDataHints();
365 break;
372 void RefreshProcessPage(void)
374 /* Signal the event so that our refresh thread */
375 /* will wake up and refresh the process page */
376 SetEvent(hProcessPageEvent);
379 static DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
381 ULONG OldProcessorUsage = 0;
382 ULONG OldProcessCount = 0;
384 WCHAR wszCPU_Usage[255];
385 WCHAR wszProcesses[255];
387 LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, sizeof(wszCPU_Usage)/sizeof(WCHAR));
388 LoadStringW(hInst, IDS_STATUS_BAR_PROCESSES, wszProcesses, sizeof(wszProcesses)/sizeof(WCHAR));
390 /* Create the event */
391 hProcessPageEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
393 /* If we couldn't create the event then exit the thread */
394 if (!hProcessPageEvent)
395 return 0;
397 while (1) {
398 DWORD dwWaitVal;
400 /* Wait on the event */
401 dwWaitVal = WaitForSingleObject(hProcessPageEvent, INFINITE);
403 /* If the wait failed then the event object must have been */
404 /* closed and the task manager is exiting so exit this thread */
405 if (dwWaitVal == WAIT_FAILED)
406 return 0;
408 if (dwWaitVal == WAIT_OBJECT_0) {
409 WCHAR text[256];
411 /* Reset our event */
412 ResetEvent(hProcessPageEvent);
414 if (SendMessageW(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0) != PerfDataGetProcessCount())
415 SendMessageW(hProcessPageListCtrl, LVM_SETITEMCOUNT, PerfDataGetProcessCount(), /*LVSICF_NOINVALIDATEALL|*/LVSICF_NOSCROLL);
417 if (IsWindowVisible(hProcessPage))
418 InvalidateRect(hProcessPageListCtrl, NULL, FALSE);
420 if (OldProcessorUsage != PerfDataGetProcessorUsage()) {
421 OldProcessorUsage = PerfDataGetProcessorUsage();
422 wsprintfW(text, wszCPU_Usage, OldProcessorUsage);
423 SendMessageW(hStatusWnd, SB_SETTEXTW, 1, (LPARAM)text);
425 if (OldProcessCount != PerfDataGetProcessCount()) {
426 OldProcessCount = PerfDataGetProcessCount();
427 wsprintfW(text, wszProcesses, OldProcessCount);
428 SendMessageW(hStatusWnd, SB_SETTEXTW, 0, (LPARAM)text);
432 return 0;
435 INT_PTR CALLBACK
436 ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
438 RECT rc;
439 int nXDifference;
440 int nYDifference;
441 int cx, cy;
443 switch (message) {
444 case WM_INITDIALOG:
446 * Save the width and height
448 GetClientRect(hDlg, &rc);
449 nProcessPageWidth = rc.right;
450 nProcessPageHeight = rc.bottom;
452 /* Update window position */
453 SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
456 * Get handles to the controls
458 hProcessPageListCtrl = GetDlgItem(hDlg, IDC_PROCESSLIST);
459 hProcessPageHeaderCtrl = (HWND)SendMessageW(hProcessPageListCtrl, LVM_GETHEADER, 0, 0);
460 hProcessPageEndProcessButton = GetDlgItem(hDlg, IDC_ENDPROCESS);
461 hProcessPageShowAllProcessesButton = GetDlgItem(hDlg, IDC_SHOWALLPROCESSES);
463 /* Enable manual column reordering, set full select */
464 SendMessageW(hProcessPageListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP,
465 LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP);
467 AddColumns();
470 * Subclass the process list control so we can intercept WM_ERASEBKGND
472 OldProcessListWndProc = (WNDPROC)SetWindowLongPtrW(hProcessPageListCtrl, GWLP_WNDPROC, (LONG_PTR)ProcessListWndProc);
474 /* Start our refresh thread */
475 CloseHandle( CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, NULL));
477 return TRUE;
479 case WM_DESTROY:
480 /* Close the event handle, this will make the */
481 /* refresh thread exit when the wait fails */
482 CloseHandle(hProcessPageEvent);
484 SaveColumnSettings();
486 break;
488 case WM_COMMAND:
489 /* Handle the button clicks */
490 switch (LOWORD(wParam))
492 case IDC_ENDPROCESS:
493 ProcessPage_OnEndProcess();
495 break;
497 case WM_SIZE:
498 if (wParam == SIZE_MINIMIZED)
499 return 0;
501 cx = LOWORD(lParam);
502 cy = HIWORD(lParam);
503 nXDifference = cx - nProcessPageWidth;
504 nYDifference = cy - nProcessPageHeight;
505 nProcessPageWidth = cx;
506 nProcessPageHeight = cy;
508 /* Reposition the application page's controls */
509 GetWindowRect(hProcessPageListCtrl, &rc);
510 cx = (rc.right - rc.left) + nXDifference;
511 cy = (rc.bottom - rc.top) + nYDifference;
512 SetWindowPos(hProcessPageListCtrl, NULL, 0, 0, cx, cy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOMOVE|SWP_NOZORDER);
513 InvalidateRect(hProcessPageListCtrl, NULL, TRUE);
515 GetClientRect(hProcessPageEndProcessButton, &rc);
516 MapWindowPoints(hProcessPageEndProcessButton, hDlg, (LPPOINT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
517 cx = rc.left + nXDifference;
518 cy = rc.top + nYDifference;
519 SetWindowPos(hProcessPageEndProcessButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
520 InvalidateRect(hProcessPageEndProcessButton, NULL, TRUE);
522 GetClientRect(hProcessPageShowAllProcessesButton, &rc);
523 MapWindowPoints(hProcessPageShowAllProcessesButton, hDlg, (LPPOINT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
524 cx = rc.left;
525 cy = rc.top + nYDifference;
526 SetWindowPos(hProcessPageShowAllProcessesButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
527 InvalidateRect(hProcessPageShowAllProcessesButton, NULL, TRUE);
529 break;
531 case WM_NOTIFY:
532 ProcessPageOnNotify(lParam);
533 break;
536 return 0;