advapi32/tests: Better identify OpenEventLogA() failures.
[wine.git] / programs / taskmgr / procpage.c
blobbaba6c6a06b5cae200050d82e13a183c0ab83297
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 switch (dwProcessPriorityClass) {
102 case REALTIME_PRIORITY_CLASS:
103 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, MF_BYCOMMAND);
104 break;
105 case HIGH_PRIORITY_CLASS:
106 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_HIGH, MF_BYCOMMAND);
107 break;
108 case ABOVE_NORMAL_PRIORITY_CLASS:
109 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL, MF_BYCOMMAND);
110 break;
111 case NORMAL_PRIORITY_CLASS:
112 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_NORMAL, MF_BYCOMMAND);
113 break;
114 case BELOW_NORMAL_PRIORITY_CLASS:
115 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL, MF_BYCOMMAND);
116 break;
117 case IDLE_PRIORITY_CLASS:
118 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_LOW, MF_BYCOMMAND);
119 break;
122 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszAeDebugRegPath, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
124 static const WCHAR wszDebugger[] = {'D','e','b','u','g','g','e','r',0};
125 dwDebuggerSize = 260;
126 if (RegQueryValueExW(hKey, wszDebugger, NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) == ERROR_SUCCESS)
128 static const WCHAR wszDRWTSN32[] = {'D','R','W','T','S','N','3','2',0};
129 for (Idx=0; Idx < lstrlenW(strDebugger); Idx++)
130 strDebugger[Idx] = toupper(strDebugger[Idx]);
132 if (wcsstr(strDebugger, wszDRWTSN32))
133 EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
135 else
136 EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
138 RegCloseKey(hKey);
139 } else {
140 EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
142 TrackPopupMenu(hSubMenu, TPM_LEFTALIGN|TPM_TOPALIGN|TPM_LEFTBUTTON, pt.x, pt.y, 0, hMainWnd, NULL);
143 DestroyMenu(hMenu);
146 static void ProcessPageOnNotify(LPARAM lParam)
148 LPNMHDR pnmh;
149 NMLVDISPINFOW* pnmdi;
150 LVITEMW lvitem;
151 ULONG Index, Count;
152 ULONG ColumnIndex;
153 IO_COUNTERS iocounters;
154 TIME time;
155 static const WCHAR wszFmtD[] = {'%','d',0};
156 static const WCHAR wszFmt02D[] = {'%','0','2','d',0};
157 static const WCHAR wszUnitK[] = {' ','K',0};
159 pnmh = (LPNMHDR) lParam;
160 pnmdi = (NMLVDISPINFOW*) lParam;
162 if (pnmh->hwndFrom == hProcessPageListCtrl)
164 switch (pnmh->code)
166 case LVN_GETDISPINFOW:
168 if (!(pnmdi->item.mask & LVIF_TEXT))
169 break;
171 ColumnIndex = pnmdi->item.iSubItem;
172 Index = pnmdi->item.iItem;
174 if (ColumnDataHints[ColumnIndex] == COLUMN_IMAGENAME)
175 PerfDataGetImageName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax);
176 if (ColumnDataHints[ColumnIndex] == COLUMN_PID)
177 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetProcessId(Index));
178 if (ColumnDataHints[ColumnIndex] == COLUMN_USERNAME)
179 PerfDataGetUserName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax);
180 if (ColumnDataHints[ColumnIndex] == COLUMN_SESSIONID)
181 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetSessionId(Index));
182 if (ColumnDataHints[ColumnIndex] == COLUMN_CPUUSAGE)
183 wsprintfW(pnmdi->item.pszText, wszFmt02D, PerfDataGetCPUUsage(Index));
184 if (ColumnDataHints[ColumnIndex] == COLUMN_CPUTIME)
186 DWORD dwHours;
187 DWORD dwMinutes;
188 DWORD dwSeconds;
189 ULONGLONG secs;
190 static const WCHAR timefmt[] = {'%','d',':','%','0','2','d',':','%','0','2','d',0};
192 time = PerfDataGetCPUTime(Index);
193 secs = time.QuadPart / 10000000;
194 dwHours = secs / 3600;
195 dwMinutes = (secs % 3600) / 60;
196 dwSeconds = (secs % 3600) % 60;
197 wsprintfW(pnmdi->item.pszText, timefmt, dwHours, dwMinutes, dwSeconds);
199 if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGE)
201 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetWorkingSetSizeBytes(Index) / 1024);
202 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
203 wcscat(pnmdi->item.pszText, wszUnitK);
205 if (ColumnDataHints[ColumnIndex] == COLUMN_PEAKMEMORYUSAGE)
207 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetPeakWorkingSetSizeBytes(Index) / 1024);
208 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
209 wcscat(pnmdi->item.pszText, wszUnitK);
211 if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGEDELTA)
213 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetWorkingSetSizeDelta(Index) / 1024);
214 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
215 wcscat(pnmdi->item.pszText, wszUnitK);
217 if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTS)
219 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetPageFaultCount(Index));
220 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
222 if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTSDELTA)
224 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetPageFaultCountDelta(Index));
225 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
227 if (ColumnDataHints[ColumnIndex] == COLUMN_VIRTUALMEMORYSIZE)
229 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetVirtualMemorySizeBytes(Index) / 1024);
230 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
231 wcscat(pnmdi->item.pszText, wszUnitK);
233 if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEDPOOL)
235 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetPagedPoolUsagePages(Index) / 1024);
236 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
237 wcscat(pnmdi->item.pszText, wszUnitK);
239 if (ColumnDataHints[ColumnIndex] == COLUMN_NONPAGEDPOOL)
241 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetNonPagedPoolUsagePages(Index) / 1024);
242 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
243 wcscat(pnmdi->item.pszText, wszUnitK);
245 if (ColumnDataHints[ColumnIndex] == COLUMN_BASEPRIORITY)
246 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetBasePriority(Index));
247 if (ColumnDataHints[ColumnIndex] == COLUMN_HANDLECOUNT)
249 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetHandleCount(Index));
250 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
252 if (ColumnDataHints[ColumnIndex] == COLUMN_THREADCOUNT)
254 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetThreadCount(Index));
255 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
257 if (ColumnDataHints[ColumnIndex] == COLUMN_USEROBJECTS)
259 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetUSERObjectCount(Index));
260 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
262 if (ColumnDataHints[ColumnIndex] == COLUMN_GDIOBJECTS)
264 wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetGDIObjectCount(Index));
265 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
267 if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADS)
269 PerfDataGetIOCounters(Index, &iocounters);
270 /* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.ReadOperationCount); */
271 _ui64tow(iocounters.ReadOperationCount, pnmdi->item.pszText, 10);
272 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
274 if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITES)
276 PerfDataGetIOCounters(Index, &iocounters);
277 /* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.WriteOperationCount); */
278 _ui64tow(iocounters.WriteOperationCount, pnmdi->item.pszText, 10);
279 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
281 if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHER)
283 PerfDataGetIOCounters(Index, &iocounters);
284 /* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.OtherOperationCount); */
285 _ui64tow(iocounters.OtherOperationCount, pnmdi->item.pszText, 10);
286 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
288 if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADBYTES)
290 PerfDataGetIOCounters(Index, &iocounters);
291 /* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.ReadTransferCount); */
292 _ui64tow(iocounters.ReadTransferCount, pnmdi->item.pszText, 10);
293 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
295 if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITEBYTES)
297 PerfDataGetIOCounters(Index, &iocounters);
298 /* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.WriteTransferCount); */
299 _ui64tow(iocounters.WriteTransferCount, pnmdi->item.pszText, 10);
300 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
302 if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHERBYTES)
304 PerfDataGetIOCounters(Index, &iocounters);
305 /* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.OtherTransferCount); */
306 _ui64tow(iocounters.OtherTransferCount, pnmdi->item.pszText, 10);
307 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
310 break;
312 case NM_RCLICK:
313 Count = SendMessageW(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
314 for (Index=0; Index<Count; Index++)
316 lvitem.mask = LVIF_STATE;
317 lvitem.stateMask = LVIS_SELECTED;
318 lvitem.iItem = Index;
319 lvitem.iSubItem = 0;
321 SendMessageW(hProcessPageListCtrl, LVM_GETITEMW, 0, (LPARAM) &lvitem);
323 if (lvitem.state & LVIS_SELECTED)
324 break;
327 if ((SendMessageW(hProcessPageListCtrl, LVM_GETSELECTEDCOUNT, 0, 0) == 1) &&
328 (PerfDataGetProcessId(Index) != 0))
330 ProcessPageShowContextMenu(PerfDataGetProcessId(Index));
333 break;
337 else if (pnmh->hwndFrom == hProcessPageHeaderCtrl)
339 switch (pnmh->code)
341 case HDN_ITEMCLICKW:
344 * FIXME: Fix the column sorting
346 *ListView_SortItems(hApplicationPageListCtrl, ApplicationPageCompareFunc, NULL);
347 *bSortAscending = !bSortAscending;
350 break;
352 case HDN_ITEMCHANGEDW:
354 UpdateColumnDataHints();
356 break;
358 case HDN_ENDDRAG:
360 UpdateColumnDataHints();
362 break;
369 void RefreshProcessPage(void)
371 /* Signal the event so that our refresh thread */
372 /* will wake up and refresh the process page */
373 SetEvent(hProcessPageEvent);
376 static DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
378 ULONG OldProcessorUsage = 0;
379 ULONG OldProcessCount = 0;
381 WCHAR wszCPU_Usage[255];
382 WCHAR wszProcesses[255];
384 LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, ARRAY_SIZE(wszCPU_Usage));
385 LoadStringW(hInst, IDS_STATUS_BAR_PROCESSES, wszProcesses, ARRAY_SIZE(wszProcesses));
387 /* Create the event */
388 hProcessPageEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
390 /* If we couldn't create the event then exit the thread */
391 if (!hProcessPageEvent)
392 return 0;
394 while (1) {
395 DWORD dwWaitVal;
397 /* Wait on the event */
398 dwWaitVal = WaitForSingleObject(hProcessPageEvent, INFINITE);
400 /* If the wait failed then the event object must have been */
401 /* closed and the task manager is exiting so exit this thread */
402 if (dwWaitVal == WAIT_FAILED)
403 return 0;
405 if (dwWaitVal == WAIT_OBJECT_0) {
406 WCHAR text[256];
408 /* Reset our event */
409 ResetEvent(hProcessPageEvent);
411 if (SendMessageW(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0) != PerfDataGetProcessCount())
412 SendMessageW(hProcessPageListCtrl, LVM_SETITEMCOUNT, PerfDataGetProcessCount(), /*LVSICF_NOINVALIDATEALL|*/LVSICF_NOSCROLL);
414 if (IsWindowVisible(hProcessPage))
415 InvalidateRect(hProcessPageListCtrl, NULL, FALSE);
417 if (OldProcessorUsage != PerfDataGetProcessorUsage()) {
418 OldProcessorUsage = PerfDataGetProcessorUsage();
419 wsprintfW(text, wszCPU_Usage, OldProcessorUsage);
420 SendMessageW(hStatusWnd, SB_SETTEXTW, 1, (LPARAM)text);
422 if (OldProcessCount != PerfDataGetProcessCount()) {
423 OldProcessCount = PerfDataGetProcessCount();
424 wsprintfW(text, wszProcesses, OldProcessCount);
425 SendMessageW(hStatusWnd, SB_SETTEXTW, 0, (LPARAM)text);
429 return 0;
432 INT_PTR CALLBACK
433 ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
435 RECT rc;
436 int nXDifference;
437 int nYDifference;
438 int cx, cy;
440 switch (message) {
441 case WM_INITDIALOG:
443 * Save the width and height
445 GetClientRect(hDlg, &rc);
446 nProcessPageWidth = rc.right;
447 nProcessPageHeight = rc.bottom;
449 /* Update window position */
450 SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
453 * Get handles to the controls
455 hProcessPageListCtrl = GetDlgItem(hDlg, IDC_PROCESSLIST);
456 hProcessPageHeaderCtrl = (HWND)SendMessageW(hProcessPageListCtrl, LVM_GETHEADER, 0, 0);
457 hProcessPageEndProcessButton = GetDlgItem(hDlg, IDC_ENDPROCESS);
458 hProcessPageShowAllProcessesButton = GetDlgItem(hDlg, IDC_SHOWALLPROCESSES);
460 /* Enable manual column reordering, set full select */
461 SendMessageW(hProcessPageListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP,
462 LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP);
464 AddColumns();
467 * Subclass the process list control so we can intercept WM_ERASEBKGND
469 OldProcessListWndProc = (WNDPROC)SetWindowLongPtrW(hProcessPageListCtrl, GWLP_WNDPROC, (LONG_PTR)ProcessListWndProc);
471 /* Start our refresh thread */
472 CloseHandle( CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, NULL));
474 return TRUE;
476 case WM_DESTROY:
477 /* Close the event handle, this will make the */
478 /* refresh thread exit when the wait fails */
479 CloseHandle(hProcessPageEvent);
481 SaveColumnSettings();
483 break;
485 case WM_COMMAND:
486 /* Handle the button clicks */
487 switch (LOWORD(wParam))
489 case IDC_ENDPROCESS:
490 ProcessPage_OnEndProcess();
492 break;
494 case WM_SIZE:
495 if (wParam == SIZE_MINIMIZED)
496 return 0;
498 cx = LOWORD(lParam);
499 cy = HIWORD(lParam);
500 nXDifference = cx - nProcessPageWidth;
501 nYDifference = cy - nProcessPageHeight;
502 nProcessPageWidth = cx;
503 nProcessPageHeight = cy;
505 /* Reposition the application page's controls */
506 GetWindowRect(hProcessPageListCtrl, &rc);
507 cx = (rc.right - rc.left) + nXDifference;
508 cy = (rc.bottom - rc.top) + nYDifference;
509 SetWindowPos(hProcessPageListCtrl, NULL, 0, 0, cx, cy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOMOVE|SWP_NOZORDER);
510 InvalidateRect(hProcessPageListCtrl, NULL, TRUE);
512 GetClientRect(hProcessPageEndProcessButton, &rc);
513 MapWindowPoints(hProcessPageEndProcessButton, hDlg, (LPPOINT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
514 cx = rc.left + nXDifference;
515 cy = rc.top + nYDifference;
516 SetWindowPos(hProcessPageEndProcessButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
517 InvalidateRect(hProcessPageEndProcessButton, NULL, TRUE);
519 GetClientRect(hProcessPageShowAllProcessesButton, &rc);
520 MapWindowPoints(hProcessPageShowAllProcessesButton, hDlg, (LPPOINT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
521 cx = rc.left;
522 cy = rc.top + nYDifference;
523 SetWindowPos(hProcessPageShowAllProcessesButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
524 InvalidateRect(hProcessPageShowAllProcessesButton, NULL, TRUE);
526 break;
528 case WM_NOTIFY:
529 ProcessPageOnNotify(lParam);
530 break;
533 return 0;