push 3cf4bc9cdb38c4fc36232fe19b9b904fd4d068e9
[wine/hacks.git] / programs / taskmgr / procpage.c
blobadbf46960398f247a12d84d5136694ffbe75a417
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 #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
24 #include <windows.h>
25 #include <commctrl.h>
26 #include <stdlib.h>
27 #include <memory.h>
28 #include <tchar.h>
29 #include <stdio.h>
30 #include <winnt.h>
32 #include "taskmgr.h"
33 #include "perfdata.h"
34 #include "column.h"
35 #include <ctype.h>
37 HWND hProcessPage; /* Process List Property Page */
39 HWND hProcessPageListCtrl; /* Process ListCtrl Window */
40 HWND hProcessPageHeaderCtrl; /* Process Header Control */
41 HWND hProcessPageEndProcessButton; /* Process End Process button */
42 HWND hProcessPageShowAllProcessesButton;/* Process Show All Processes checkbox */
44 static int nProcessPageWidth;
45 static int nProcessPageHeight;
47 static HANDLE hProcessPageEvent = NULL; /* When this event becomes signaled then we refresh the process list */
50 static void CommaSeparateNumberString(LPTSTR strNumber, int nMaxCount)
52 TCHAR temp[260];
53 UINT i, j, k;
55 for (i=0,j=0; i<(_tcslen(strNumber) % 3); i++, j++)
56 temp[j] = strNumber[i];
57 for (k=0; i<_tcslen(strNumber); i++,j++,k++) {
58 if ((k % 3 == 0) && (j > 0))
59 temp[j++] = _T(',');
60 temp[j] = strNumber[i];
62 temp[j] = _T('\0');
63 _tcsncpy(strNumber, temp, nMaxCount);
66 static void ProcessPageShowContextMenu(DWORD dwProcessId)
68 HMENU hMenu;
69 HMENU hSubMenu;
70 HMENU hPriorityMenu;
71 POINT pt;
72 SYSTEM_INFO si;
73 HANDLE hProcess;
74 DWORD dwProcessPriorityClass;
75 TCHAR strDebugger[260];
76 DWORD dwDebuggerSize;
77 HKEY hKey;
78 UINT Idx;
80 memset(&si, 0, sizeof(SYSTEM_INFO));
82 GetCursorPos(&pt);
83 GetSystemInfo(&si);
85 hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_PROCESS_PAGE_CONTEXT));
86 hSubMenu = GetSubMenu(hMenu, 0);
87 hPriorityMenu = GetSubMenu(hSubMenu, 4);
89 hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dwProcessId);
90 dwProcessPriorityClass = GetPriorityClass(hProcess);
91 CloseHandle(hProcess);
93 if (si.dwNumberOfProcessors < 2)
94 RemoveMenu(hSubMenu, ID_PROCESS_PAGE_SETAFFINITY, MF_BYCOMMAND);
96 if (!AreDebugChannelsSupported())
97 RemoveMenu(hSubMenu, ID_PROCESS_PAGE_DEBUGCHANNELS, MF_BYCOMMAND);
99 switch (dwProcessPriorityClass) {
100 case REALTIME_PRIORITY_CLASS:
101 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, MF_BYCOMMAND);
102 break;
103 case HIGH_PRIORITY_CLASS:
104 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_HIGH, MF_BYCOMMAND);
105 break;
106 case ABOVE_NORMAL_PRIORITY_CLASS:
107 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL, MF_BYCOMMAND);
108 break;
109 case NORMAL_PRIORITY_CLASS:
110 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_NORMAL, MF_BYCOMMAND);
111 break;
112 case BELOW_NORMAL_PRIORITY_CLASS:
113 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL, MF_BYCOMMAND);
114 break;
115 case IDLE_PRIORITY_CLASS:
116 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_LOW, MF_BYCOMMAND);
117 break;
120 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug"), 0, KEY_READ, &hKey) == ERROR_SUCCESS)
122 dwDebuggerSize = 260;
123 if (RegQueryValueEx(hKey, _T("Debugger"), NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) == ERROR_SUCCESS)
125 for (Idx=0; Idx<_tcslen(strDebugger); Idx++)
126 strDebugger[Idx] = toupper(strDebugger[Idx]);
128 if (_tcsstr(strDebugger, _T("DRWTSN32")))
129 EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
131 else
132 EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
134 RegCloseKey(hKey);
135 } else {
136 EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
138 TrackPopupMenu(hSubMenu, TPM_LEFTALIGN|TPM_TOPALIGN|TPM_LEFTBUTTON, pt.x, pt.y, 0, hMainWnd, NULL);
139 DestroyMenu(hMenu);
142 static void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
144 int idctrl;
145 LPNMHDR pnmh;
146 LPNMLISTVIEW pnmv;
147 NMLVDISPINFO* pnmdi;
148 LPNMHEADER pnmhdr;
149 LVITEM lvitem;
150 ULONG Index;
151 ULONG ColumnIndex;
152 IO_COUNTERS iocounters;
153 TIME time;
155 idctrl = (int) wParam;
156 pnmh = (LPNMHDR) lParam;
157 pnmv = (LPNMLISTVIEW) lParam;
158 pnmdi = (NMLVDISPINFO*) lParam;
159 pnmhdr = (LPNMHEADER) lParam;
161 if (pnmh->hwndFrom == hProcessPageListCtrl)
163 switch (pnmh->code)
165 #if 0
166 case LVN_ITEMCHANGED:
167 ProcessPageUpdate();
168 break;
169 #endif
171 case LVN_GETDISPINFO:
173 if (!(pnmdi->item.mask & LVIF_TEXT))
174 break;
176 ColumnIndex = pnmdi->item.iSubItem;
177 Index = pnmdi->item.iItem;
179 if (ColumnDataHints[ColumnIndex] == COLUMN_IMAGENAME)
180 PerfDataGetImageName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax);
181 if (ColumnDataHints[ColumnIndex] == COLUMN_PID)
182 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetProcessId(Index));
183 if (ColumnDataHints[ColumnIndex] == COLUMN_USERNAME)
184 PerfDataGetUserName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax);
185 if (ColumnDataHints[ColumnIndex] == COLUMN_SESSIONID)
186 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetSessionId(Index));
187 if (ColumnDataHints[ColumnIndex] == COLUMN_CPUUSAGE)
188 wsprintf(pnmdi->item.pszText, _T("%02d"), PerfDataGetCPUUsage(Index));
189 if (ColumnDataHints[ColumnIndex] == COLUMN_CPUTIME)
191 DWORD dwHours;
192 DWORD dwMinutes;
193 DWORD dwSeconds;
194 ULONGLONG secs;
196 time = PerfDataGetCPUTime(Index);
197 secs = time.QuadPart / 10000000;
198 dwHours = secs / 3600;
199 dwMinutes = (secs % 3600) / 60;
200 dwSeconds = (secs % 3600) % 60;
201 wsprintf(pnmdi->item.pszText, _T("%d:%02d:%02d"), dwHours, dwMinutes, dwSeconds);
203 if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGE)
205 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetWorkingSetSizeBytes(Index) / 1024);
206 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
207 _tcscat(pnmdi->item.pszText, _T(" K"));
209 if (ColumnDataHints[ColumnIndex] == COLUMN_PEAKMEMORYUSAGE)
211 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPeakWorkingSetSizeBytes(Index) / 1024);
212 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
213 _tcscat(pnmdi->item.pszText, _T(" K"));
215 if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGEDELTA)
217 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetWorkingSetSizeDelta(Index) / 1024);
218 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
219 _tcscat(pnmdi->item.pszText, _T(" K"));
221 if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTS)
223 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPageFaultCount(Index));
224 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
226 if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTSDELTA)
228 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPageFaultCountDelta(Index));
229 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
231 if (ColumnDataHints[ColumnIndex] == COLUMN_VIRTUALMEMORYSIZE)
233 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetVirtualMemorySizeBytes(Index) / 1024);
234 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
235 _tcscat(pnmdi->item.pszText, _T(" K"));
237 if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEDPOOL)
239 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPagedPoolUsagePages(Index) / 1024);
240 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
241 _tcscat(pnmdi->item.pszText, _T(" K"));
243 if (ColumnDataHints[ColumnIndex] == COLUMN_NONPAGEDPOOL)
245 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetNonPagedPoolUsagePages(Index) / 1024);
246 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
247 _tcscat(pnmdi->item.pszText, _T(" K"));
249 if (ColumnDataHints[ColumnIndex] == COLUMN_BASEPRIORITY)
250 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetBasePriority(Index));
251 if (ColumnDataHints[ColumnIndex] == COLUMN_HANDLECOUNT)
253 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetHandleCount(Index));
254 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
256 if (ColumnDataHints[ColumnIndex] == COLUMN_THREADCOUNT)
258 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetThreadCount(Index));
259 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
261 if (ColumnDataHints[ColumnIndex] == COLUMN_USEROBJECTS)
263 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetUSERObjectCount(Index));
264 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
266 if (ColumnDataHints[ColumnIndex] == COLUMN_GDIOBJECTS)
268 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetGDIObjectCount(Index));
269 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
271 if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADS)
273 PerfDataGetIOCounters(Index, &iocounters);
274 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadOperationCount); */
275 #ifdef UNICODE
276 #define _ui64toa _ui64tow
277 #else
278 #endif
279 _ui64toa(iocounters.ReadOperationCount, pnmdi->item.pszText, 10);
280 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
282 if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITES)
284 PerfDataGetIOCounters(Index, &iocounters);
285 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteOperationCount); */
286 _ui64toa(iocounters.WriteOperationCount, pnmdi->item.pszText, 10);
287 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
289 if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHER)
291 PerfDataGetIOCounters(Index, &iocounters);
292 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherOperationCount); */
293 _ui64toa(iocounters.OtherOperationCount, pnmdi->item.pszText, 10);
294 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
296 if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADBYTES)
298 PerfDataGetIOCounters(Index, &iocounters);
299 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadTransferCount); */
300 _ui64toa(iocounters.ReadTransferCount, pnmdi->item.pszText, 10);
301 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
303 if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITEBYTES)
305 PerfDataGetIOCounters(Index, &iocounters);
306 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteTransferCount); */
307 _ui64toa(iocounters.WriteTransferCount, pnmdi->item.pszText, 10);
308 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
310 if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHERBYTES)
312 PerfDataGetIOCounters(Index, &iocounters);
313 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherTransferCount); */
314 _ui64toa(iocounters.OtherTransferCount, pnmdi->item.pszText, 10);
315 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
318 break;
320 case NM_RCLICK:
322 for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
324 lvitem.mask = LVIF_STATE;
325 lvitem.stateMask = LVIS_SELECTED;
326 lvitem.iItem = Index;
327 lvitem.iSubItem = 0;
329 SendMessage(hProcessPageListCtrl, LVM_GETITEM, 0, (LPARAM) &lvitem);
331 if (lvitem.state & LVIS_SELECTED)
332 break;
335 if ((ListView_GetSelectedCount(hProcessPageListCtrl) == 1) &&
336 (PerfDataGetProcessId(Index) != 0))
338 ProcessPageShowContextMenu(PerfDataGetProcessId(Index));
341 break;
345 else if (pnmh->hwndFrom == hProcessPageHeaderCtrl)
347 switch (pnmh->code)
349 case HDN_ITEMCLICK:
352 * FIXME: Fix the column sorting
354 *ListView_SortItems(hApplicationPageListCtrl, ApplicationPageCompareFunc, NULL);
355 *bSortAscending = !bSortAscending;
358 break;
360 case HDN_ITEMCHANGED:
362 UpdateColumnDataHints();
364 break;
366 case HDN_ENDDRAG:
368 UpdateColumnDataHints();
370 break;
377 void RefreshProcessPage(void)
379 /* Signal the event so that our refresh thread */
380 /* will wake up and refresh the process page */
381 SetEvent(hProcessPageEvent);
384 static DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
386 ULONG OldProcessorUsage = 0;
387 ULONG OldProcessCount = 0;
389 /* Create the event */
390 hProcessPageEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
392 /* If we couldn't create the event then exit the thread */
393 if (!hProcessPageEvent)
394 return 0;
396 while (1) {
397 DWORD dwWaitVal;
399 /* Wait on the event */
400 dwWaitVal = WaitForSingleObject(hProcessPageEvent, INFINITE);
402 /* If the wait failed then the event object must have been */
403 /* closed and the task manager is exiting so exit this thread */
404 if (dwWaitVal == WAIT_FAILED)
405 return 0;
407 if (dwWaitVal == WAIT_OBJECT_0) {
408 TCHAR text[260];
410 /* Reset our event */
411 ResetEvent(hProcessPageEvent);
413 if ((ULONG)SendMessage(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0) != PerfDataGetProcessCount())
414 SendMessage(hProcessPageListCtrl, LVM_SETITEMCOUNT, PerfDataGetProcessCount(), /*LVSICF_NOINVALIDATEALL|*/LVSICF_NOSCROLL);
416 if (IsWindowVisible(hProcessPage))
417 InvalidateRect(hProcessPageListCtrl, NULL, FALSE);
419 if (OldProcessorUsage != PerfDataGetProcessorUsage()) {
420 OldProcessorUsage = PerfDataGetProcessorUsage();
421 wsprintf(text, _T("CPU Usage: %3d%%"), OldProcessorUsage);
422 SendMessage(hStatusWnd, SB_SETTEXT, 1, (LPARAM)text);
424 if (OldProcessCount != PerfDataGetProcessCount()) {
425 OldProcessCount = PerfDataGetProcessCount();
426 wsprintf(text, _T("Processes: %d"), OldProcessCount);
427 SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)text);
431 return 0;
434 INT_PTR CALLBACK
435 ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
437 RECT rc;
438 int nXDifference;
439 int nYDifference;
440 int cx, cy;
442 switch (message) {
443 case WM_INITDIALOG:
445 * Save the width and height
447 GetClientRect(hDlg, &rc);
448 nProcessPageWidth = rc.right;
449 nProcessPageHeight = rc.bottom;
451 /* Update window position */
452 SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
455 * Get handles to the controls
457 hProcessPageListCtrl = GetDlgItem(hDlg, IDC_PROCESSLIST);
458 hProcessPageHeaderCtrl = ListView_GetHeader(hProcessPageListCtrl);
459 hProcessPageEndProcessButton = GetDlgItem(hDlg, IDC_ENDPROCESS);
460 hProcessPageShowAllProcessesButton = GetDlgItem(hDlg, IDC_SHOWALLPROCESSES);
463 * Set the title and extended window styles for the list control
465 SetWindowText(hProcessPageListCtrl, _T("Processes"));
466 SendMessage(hProcessPageListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, ListView_GetExtendedListViewStyle(hProcessPageListCtrl) | LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);
468 AddColumns();
471 * Subclass the process list control so we can intercept WM_ERASEBKGND
473 OldProcessListWndProc = (WNDPROC)SetWindowLongPtr(hProcessPageListCtrl, GWLP_WNDPROC, (LONG_PTR)ProcessListWndProc);
475 /* Start our refresh thread */
476 CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, NULL);
478 return TRUE;
480 case WM_DESTROY:
481 /* Close the event handle, this will make the */
482 /* refresh thread exit when the wait fails */
483 CloseHandle(hProcessPageEvent);
485 SaveColumnSettings();
487 break;
489 case WM_COMMAND:
490 /* Handle the button clicks */
491 switch (LOWORD(wParam))
493 case IDC_ENDPROCESS:
494 ProcessPage_OnEndProcess();
496 break;
498 case WM_SIZE:
499 if (wParam == SIZE_MINIMIZED)
500 return 0;
502 cx = LOWORD(lParam);
503 cy = HIWORD(lParam);
504 nXDifference = cx - nProcessPageWidth;
505 nYDifference = cy - nProcessPageHeight;
506 nProcessPageWidth = cx;
507 nProcessPageHeight = cy;
509 /* Reposition the application page's controls */
510 GetWindowRect(hProcessPageListCtrl, &rc);
511 cx = (rc.right - rc.left) + nXDifference;
512 cy = (rc.bottom - rc.top) + nYDifference;
513 SetWindowPos(hProcessPageListCtrl, NULL, 0, 0, cx, cy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOMOVE|SWP_NOZORDER);
514 InvalidateRect(hProcessPageListCtrl, NULL, TRUE);
516 GetClientRect(hProcessPageEndProcessButton, &rc);
517 MapWindowPoints(hProcessPageEndProcessButton, hDlg, (LPPOINT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
518 cx = rc.left + nXDifference;
519 cy = rc.top + nYDifference;
520 SetWindowPos(hProcessPageEndProcessButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
521 InvalidateRect(hProcessPageEndProcessButton, NULL, TRUE);
523 GetClientRect(hProcessPageShowAllProcessesButton, &rc);
524 MapWindowPoints(hProcessPageShowAllProcessesButton, hDlg, (LPPOINT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
525 cx = rc.left;
526 cy = rc.top + nYDifference;
527 SetWindowPos(hProcessPageShowAllProcessesButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
528 InvalidateRect(hProcessPageShowAllProcessesButton, NULL, TRUE);
530 break;
532 case WM_NOTIFY:
534 ProcessPageOnNotify(wParam, lParam);
535 break;
538 return 0;