user32/tests: Set last error if the menu item cannot be found.
[wine/multimedia.git] / programs / taskmgr / procpage.c
blob3450f8344cf4baab29e1a71064b7e48cb06ed9bc
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 <malloc.h>
28 #include <memory.h>
29 #include <tchar.h>
30 #include <stdio.h>
31 #include <winnt.h>
33 #include "taskmgr.h"
34 #include "perfdata.h"
35 #include "column.h"
36 #include <ctype.h>
38 HWND hProcessPage; /* Process List Property Page */
40 HWND hProcessPageListCtrl; /* Process ListCtrl Window */
41 HWND hProcessPageHeaderCtrl; /* Process Header Control */
42 HWND hProcessPageEndProcessButton; /* Process End Process button */
43 HWND hProcessPageShowAllProcessesButton;/* Process Show All Processes checkbox */
45 static int nProcessPageWidth;
46 static int nProcessPageHeight;
48 static HANDLE hProcessPageEvent = NULL; /* When this event becomes signaled then we refresh the process list */
51 static void CommaSeparateNumberString(LPTSTR strNumber, int nMaxCount)
53 TCHAR temp[260];
54 UINT i, j, k;
56 for (i=0,j=0; i<(_tcslen(strNumber) % 3); i++, j++)
57 temp[j] = strNumber[i];
58 for (k=0; i<_tcslen(strNumber); i++,j++,k++) {
59 if ((k % 3 == 0) && (j > 0))
60 temp[j++] = _T(',');
61 temp[j] = strNumber[i];
63 temp[j] = _T('\0');
64 _tcsncpy(strNumber, temp, nMaxCount);
67 static void ProcessPageShowContextMenu(DWORD dwProcessId)
69 HMENU hMenu;
70 HMENU hSubMenu;
71 HMENU hPriorityMenu;
72 POINT pt;
73 SYSTEM_INFO si;
74 HANDLE hProcess;
75 DWORD dwProcessPriorityClass;
76 TCHAR strDebugger[260];
77 DWORD dwDebuggerSize;
78 HKEY hKey;
79 UINT Idx;
81 memset(&si, 0, sizeof(SYSTEM_INFO));
83 GetCursorPos(&pt);
84 GetSystemInfo(&si);
86 hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_PROCESS_PAGE_CONTEXT));
87 hSubMenu = GetSubMenu(hMenu, 0);
88 hPriorityMenu = GetSubMenu(hSubMenu, 4);
90 hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dwProcessId);
91 dwProcessPriorityClass = GetPriorityClass(hProcess);
92 CloseHandle(hProcess);
94 if (si.dwNumberOfProcessors < 2)
95 RemoveMenu(hSubMenu, ID_PROCESS_PAGE_SETAFFINITY, MF_BYCOMMAND);
97 if (!AreDebugChannelsSupported())
98 RemoveMenu(hSubMenu, ID_PROCESS_PAGE_DEBUGCHANNELS, MF_BYCOMMAND);
100 switch (dwProcessPriorityClass) {
101 case REALTIME_PRIORITY_CLASS:
102 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, MF_BYCOMMAND);
103 break;
104 case HIGH_PRIORITY_CLASS:
105 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_HIGH, MF_BYCOMMAND);
106 break;
107 case ABOVE_NORMAL_PRIORITY_CLASS:
108 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL, MF_BYCOMMAND);
109 break;
110 case NORMAL_PRIORITY_CLASS:
111 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_NORMAL, MF_BYCOMMAND);
112 break;
113 case BELOW_NORMAL_PRIORITY_CLASS:
114 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL, MF_BYCOMMAND);
115 break;
116 case IDLE_PRIORITY_CLASS:
117 CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_LOW, MF_BYCOMMAND);
118 break;
121 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug"), 0, KEY_READ, &hKey) == ERROR_SUCCESS)
123 dwDebuggerSize = 260;
124 if (RegQueryValueEx(hKey, _T("Debugger"), NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) == ERROR_SUCCESS)
126 for (Idx=0; Idx<_tcslen(strDebugger); Idx++)
127 strDebugger[Idx] = toupper(strDebugger[Idx]);
129 if (_tcsstr(strDebugger, _T("DRWTSN32")))
130 EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
132 else
133 EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
135 RegCloseKey(hKey);
136 } else {
137 EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
139 TrackPopupMenu(hSubMenu, TPM_LEFTALIGN|TPM_TOPALIGN|TPM_LEFTBUTTON, pt.x, pt.y, 0, hMainWnd, NULL);
140 DestroyMenu(hMenu);
143 static void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
145 int idctrl;
146 LPNMHDR pnmh;
147 LPNMLISTVIEW pnmv;
148 NMLVDISPINFO* pnmdi;
149 LPNMHEADER pnmhdr;
150 LVITEM lvitem;
151 ULONG Index;
152 ULONG ColumnIndex;
153 IO_COUNTERS iocounters;
154 TIME time;
156 idctrl = (int) wParam;
157 pnmh = (LPNMHDR) lParam;
158 pnmv = (LPNMLISTVIEW) lParam;
159 pnmdi = (NMLVDISPINFO*) lParam;
160 pnmhdr = (LPNMHEADER) lParam;
162 if (pnmh->hwndFrom == hProcessPageListCtrl)
164 switch (pnmh->code)
166 #if 0
167 case LVN_ITEMCHANGED:
168 ProcessPageUpdate();
169 break;
170 #endif
172 case LVN_GETDISPINFO:
174 if (!(pnmdi->item.mask & LVIF_TEXT))
175 break;
177 ColumnIndex = pnmdi->item.iSubItem;
178 Index = pnmdi->item.iItem;
180 if (ColumnDataHints[ColumnIndex] == COLUMN_IMAGENAME)
181 PerfDataGetImageName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax);
182 if (ColumnDataHints[ColumnIndex] == COLUMN_PID)
183 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetProcessId(Index));
184 if (ColumnDataHints[ColumnIndex] == COLUMN_USERNAME)
185 PerfDataGetUserName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax);
186 if (ColumnDataHints[ColumnIndex] == COLUMN_SESSIONID)
187 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetSessionId(Index));
188 if (ColumnDataHints[ColumnIndex] == COLUMN_CPUUSAGE)
189 wsprintf(pnmdi->item.pszText, _T("%02d"), PerfDataGetCPUUsage(Index));
190 if (ColumnDataHints[ColumnIndex] == COLUMN_CPUTIME)
192 DWORD dwHours;
193 DWORD dwMinutes;
194 DWORD dwSeconds;
195 ULONGLONG secs;
197 time = PerfDataGetCPUTime(Index);
198 secs = time.QuadPart / 10000000;
199 dwHours = secs / 3600;
200 dwMinutes = (secs % 3600) / 60;
201 dwSeconds = (secs % 3600) % 60;
202 wsprintf(pnmdi->item.pszText, _T("%d:%02d:%02d"), dwHours, dwMinutes, dwSeconds);
204 if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGE)
206 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetWorkingSetSizeBytes(Index) / 1024);
207 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
208 _tcscat(pnmdi->item.pszText, _T(" K"));
210 if (ColumnDataHints[ColumnIndex] == COLUMN_PEAKMEMORYUSAGE)
212 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPeakWorkingSetSizeBytes(Index) / 1024);
213 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
214 _tcscat(pnmdi->item.pszText, _T(" K"));
216 if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGEDELTA)
218 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetWorkingSetSizeDelta(Index) / 1024);
219 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
220 _tcscat(pnmdi->item.pszText, _T(" K"));
222 if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTS)
224 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPageFaultCount(Index));
225 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
227 if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTSDELTA)
229 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPageFaultCountDelta(Index));
230 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
232 if (ColumnDataHints[ColumnIndex] == COLUMN_VIRTUALMEMORYSIZE)
234 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetVirtualMemorySizeBytes(Index) / 1024);
235 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
236 _tcscat(pnmdi->item.pszText, _T(" K"));
238 if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEDPOOL)
240 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPagedPoolUsagePages(Index) / 1024);
241 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
242 _tcscat(pnmdi->item.pszText, _T(" K"));
244 if (ColumnDataHints[ColumnIndex] == COLUMN_NONPAGEDPOOL)
246 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetNonPagedPoolUsagePages(Index) / 1024);
247 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
248 _tcscat(pnmdi->item.pszText, _T(" K"));
250 if (ColumnDataHints[ColumnIndex] == COLUMN_BASEPRIORITY)
251 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetBasePriority(Index));
252 if (ColumnDataHints[ColumnIndex] == COLUMN_HANDLECOUNT)
254 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetHandleCount(Index));
255 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
257 if (ColumnDataHints[ColumnIndex] == COLUMN_THREADCOUNT)
259 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetThreadCount(Index));
260 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
262 if (ColumnDataHints[ColumnIndex] == COLUMN_USEROBJECTS)
264 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetUSERObjectCount(Index));
265 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
267 if (ColumnDataHints[ColumnIndex] == COLUMN_GDIOBJECTS)
269 wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetGDIObjectCount(Index));
270 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
272 if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADS)
274 PerfDataGetIOCounters(Index, &iocounters);
275 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadOperationCount); */
276 #ifdef UNICODE
277 #define _ui64toa _ui64tow
278 #else
279 #endif
280 _ui64toa(iocounters.ReadOperationCount, pnmdi->item.pszText, 10);
281 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
283 if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITES)
285 PerfDataGetIOCounters(Index, &iocounters);
286 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteOperationCount); */
287 _ui64toa(iocounters.WriteOperationCount, pnmdi->item.pszText, 10);
288 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
290 if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHER)
292 PerfDataGetIOCounters(Index, &iocounters);
293 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherOperationCount); */
294 _ui64toa(iocounters.OtherOperationCount, pnmdi->item.pszText, 10);
295 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
297 if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADBYTES)
299 PerfDataGetIOCounters(Index, &iocounters);
300 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadTransferCount); */
301 _ui64toa(iocounters.ReadTransferCount, pnmdi->item.pszText, 10);
302 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
304 if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITEBYTES)
306 PerfDataGetIOCounters(Index, &iocounters);
307 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteTransferCount); */
308 _ui64toa(iocounters.WriteTransferCount, pnmdi->item.pszText, 10);
309 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
311 if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHERBYTES)
313 PerfDataGetIOCounters(Index, &iocounters);
314 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherTransferCount); */
315 _ui64toa(iocounters.OtherTransferCount, pnmdi->item.pszText, 10);
316 CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
319 break;
321 case NM_RCLICK:
323 for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
325 lvitem.mask = LVIF_STATE;
326 lvitem.stateMask = LVIS_SELECTED;
327 lvitem.iItem = Index;
328 lvitem.iSubItem = 0;
330 SendMessage(hProcessPageListCtrl, LVM_GETITEM, 0, (LPARAM) &lvitem);
332 if (lvitem.state & LVIS_SELECTED)
333 break;
336 if ((ListView_GetSelectedCount(hProcessPageListCtrl) == 1) &&
337 (PerfDataGetProcessId(Index) != 0))
339 ProcessPageShowContextMenu(PerfDataGetProcessId(Index));
342 break;
346 else if (pnmh->hwndFrom == hProcessPageHeaderCtrl)
348 switch (pnmh->code)
350 case HDN_ITEMCLICK:
353 * FIXME: Fix the column sorting
355 *ListView_SortItems(hApplicationPageListCtrl, ApplicationPageCompareFunc, NULL);
356 *bSortAscending = !bSortAscending;
359 break;
361 case HDN_ITEMCHANGED:
363 UpdateColumnDataHints();
365 break;
367 case HDN_ENDDRAG:
369 UpdateColumnDataHints();
371 break;
378 void RefreshProcessPage(void)
380 /* Signal the event so that our refresh thread */
381 /* will wake up and refresh the process page */
382 SetEvent(hProcessPageEvent);
385 static DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
387 ULONG OldProcessorUsage = 0;
388 ULONG OldProcessCount = 0;
390 /* Create the event */
391 hProcessPageEvent = CreateEvent(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 TCHAR text[260];
411 /* Reset our event */
412 ResetEvent(hProcessPageEvent);
414 if ((ULONG)SendMessage(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0) != PerfDataGetProcessCount())
415 SendMessage(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 wsprintf(text, _T("CPU Usage: %3d%%"), OldProcessorUsage);
423 SendMessage(hStatusWnd, SB_SETTEXT, 1, (LPARAM)text);
425 if (OldProcessCount != PerfDataGetProcessCount()) {
426 OldProcessCount = PerfDataGetProcessCount();
427 wsprintf(text, _T("Processes: %d"), OldProcessCount);
428 SendMessage(hStatusWnd, SB_SETTEXT, 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 = ListView_GetHeader(hProcessPageListCtrl);
460 hProcessPageEndProcessButton = GetDlgItem(hDlg, IDC_ENDPROCESS);
461 hProcessPageShowAllProcessesButton = GetDlgItem(hDlg, IDC_SHOWALLPROCESSES);
464 * Set the title and extended window styles for the list control
466 SetWindowText(hProcessPageListCtrl, _T("Processes"));
467 SendMessage(hProcessPageListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, ListView_GetExtendedListViewStyle(hProcessPageListCtrl) | LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);
469 AddColumns();
472 * Subclass the process list control so we can intercept WM_ERASEBKGND
474 OldProcessListWndProc = (WNDPROC)SetWindowLongPtr(hProcessPageListCtrl, GWLP_WNDPROC, (LONG_PTR)ProcessListWndProc);
476 /* Start our refresh thread */
477 CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, NULL);
479 return TRUE;
481 case WM_DESTROY:
482 /* Close the event handle, this will make the */
483 /* refresh thread exit when the wait fails */
484 CloseHandle(hProcessPageEvent);
486 SaveColumnSettings();
488 break;
490 case WM_COMMAND:
491 /* Handle the button clicks */
492 switch (LOWORD(wParam))
494 case IDC_ENDPROCESS:
495 ProcessPage_OnEndProcess();
497 break;
499 case WM_SIZE:
500 if (wParam == SIZE_MINIMIZED)
501 return 0;
503 cx = LOWORD(lParam);
504 cy = HIWORD(lParam);
505 nXDifference = cx - nProcessPageWidth;
506 nYDifference = cy - nProcessPageHeight;
507 nProcessPageWidth = cx;
508 nProcessPageHeight = cy;
510 /* Reposition the application page's controls */
511 GetWindowRect(hProcessPageListCtrl, &rc);
512 cx = (rc.right - rc.left) + nXDifference;
513 cy = (rc.bottom - rc.top) + nYDifference;
514 SetWindowPos(hProcessPageListCtrl, NULL, 0, 0, cx, cy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOMOVE|SWP_NOZORDER);
515 InvalidateRect(hProcessPageListCtrl, NULL, TRUE);
517 GetClientRect(hProcessPageEndProcessButton, &rc);
518 MapWindowPoints(hProcessPageEndProcessButton, hDlg, (LPPOINT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
519 cx = rc.left + nXDifference;
520 cy = rc.top + nYDifference;
521 SetWindowPos(hProcessPageEndProcessButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
522 InvalidateRect(hProcessPageEndProcessButton, NULL, TRUE);
524 GetClientRect(hProcessPageShowAllProcessesButton, &rc);
525 MapWindowPoints(hProcessPageShowAllProcessesButton, hDlg, (LPPOINT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
526 cx = rc.left;
527 cy = rc.top + nYDifference;
528 SetWindowPos(hProcessPageShowAllProcessesButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
529 InvalidateRect(hProcessPageShowAllProcessesButton, NULL, TRUE);
531 break;
533 case WM_NOTIFY:
535 ProcessPageOnNotify(wParam, lParam);
536 break;
539 return 0;