mirror of
https://github.com/reactos/reactos.git
synced 2025-04-27 17:10:22 +00:00
Compleated the update of the license headers and converted most
of the rest of the C++ style comments to C. svn path=/trunk/; revision=7502
This commit is contained in:
parent
f45476a7fb
commit
09a23ffea3
19 changed files with 768 additions and 786 deletions
|
@ -5,22 +5,22 @@
|
|||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -80,19 +80,19 @@ LRESULT CALLBACK AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, L
|
|||
switch (message) {
|
||||
case WM_INITDIALOG:
|
||||
|
||||
//
|
||||
// Get the current affinity mask for the process and
|
||||
// the number of CPUs present in the system
|
||||
//
|
||||
/*
|
||||
* Get the current affinity mask for the process and
|
||||
* the number of CPUs present in the system
|
||||
*/
|
||||
if (!GetProcessAffinityMask(hProcessAffinityHandle, &dwProcessAffinityMask, &dwSystemAffinityMask)) {
|
||||
GetLastErrorText(strErrorText, 260);
|
||||
EndDialog(hDlg, 0);
|
||||
MessageBox(hMainWnd, strErrorText, _T("Unable to Access or Set Process Affinity"), MB_OK|MB_ICONSTOP);
|
||||
}
|
||||
|
||||
//
|
||||
// Enable a checkbox for each processor present in the system
|
||||
//
|
||||
/*
|
||||
* Enable a checkbox for each processor present in the system
|
||||
*/
|
||||
if (dwSystemAffinityMask & 0x00000001)
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_CPU0), TRUE);
|
||||
if (dwSystemAffinityMask & 0x00000002)
|
||||
|
@ -159,10 +159,10 @@ LRESULT CALLBACK AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, L
|
|||
EnableWindow(GetDlgItem(hDlg, IDC_CPU31), TRUE);
|
||||
|
||||
|
||||
//
|
||||
// Check each checkbox that the current process
|
||||
// has affinity with
|
||||
//
|
||||
/*
|
||||
* Check each checkbox that the current process
|
||||
* has affinity with
|
||||
*/
|
||||
if (dwProcessAffinityMask & 0x00000001)
|
||||
SendMessage(GetDlgItem(hDlg, IDC_CPU0), BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwProcessAffinityMask & 0x00000002)
|
||||
|
@ -232,24 +232,24 @@ LRESULT CALLBACK AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, L
|
|||
|
||||
case WM_COMMAND:
|
||||
|
||||
//
|
||||
// If the user has cancelled the dialog box
|
||||
// then just close it
|
||||
//
|
||||
/*
|
||||
* If the user has cancelled the dialog box
|
||||
* then just close it
|
||||
*/
|
||||
if (LOWORD(wParam) == IDCANCEL) {
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// The user has clicked OK -- so now we have
|
||||
// to adjust the process affinity mask
|
||||
//
|
||||
/*
|
||||
* The user has clicked OK -- so now we have
|
||||
* to adjust the process affinity mask
|
||||
*/
|
||||
if (LOWORD(wParam) == IDOK) {
|
||||
//
|
||||
// First we have to create a mask out of each
|
||||
// checkbox that the user checked.
|
||||
//
|
||||
/*
|
||||
* First we have to create a mask out of each
|
||||
* checkbox that the user checked.
|
||||
*/
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU0), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x00000001;
|
||||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU1), BM_GETCHECK, 0, 0))
|
||||
|
@ -315,20 +315,20 @@ LRESULT CALLBACK AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, L
|
|||
if (SendMessage(GetDlgItem(hDlg, IDC_CPU31), BM_GETCHECK, 0, 0))
|
||||
dwProcessAffinityMask |= 0x80000000;
|
||||
|
||||
//
|
||||
// Make sure they are giving the process affinity
|
||||
// with at least one processor. I'd hate to see a
|
||||
// process that is not in a wait state get deprived
|
||||
// of it's cpu time.
|
||||
//
|
||||
/*
|
||||
* Make sure they are giving the process affinity
|
||||
* with at least one processor. I'd hate to see a
|
||||
* process that is not in a wait state get deprived
|
||||
* of it's cpu time.
|
||||
*/
|
||||
if (!dwProcessAffinityMask) {
|
||||
MessageBox(hDlg, _T("The process must have affinity with at least one processor."), _T("Invalid Option"), MB_OK|MB_ICONSTOP);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// Try to set the process affinity
|
||||
//
|
||||
/*
|
||||
* Try to set the process affinity
|
||||
*/
|
||||
if (!SetProcessAffinityMask(hProcessAffinityHandle, dwProcessAffinityMask)) {
|
||||
GetLastErrorText(strErrorText, 260);
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -42,20 +42,15 @@ typedef struct
|
|||
BOOL bHung;
|
||||
} APPLICATION_PAGE_LIST_ITEM, *LPAPPLICATION_PAGE_LIST_ITEM;
|
||||
|
||||
HWND hApplicationPage; // Application List Property Page
|
||||
|
||||
HWND hApplicationPageListCtrl; // Application ListCtrl Window
|
||||
HWND hApplicationPageEndTaskButton; // Application End Task button
|
||||
HWND hApplicationPageSwitchToButton; // Application Switch To button
|
||||
HWND hApplicationPageNewTaskButton; // Application New Task button
|
||||
|
||||
HWND hApplicationPage; /* Application List Property Page */
|
||||
HWND hApplicationPageListCtrl; /* Application ListCtrl Window */
|
||||
HWND hApplicationPageEndTaskButton; /* Application End Task button */
|
||||
HWND hApplicationPageSwitchToButton; /* Application Switch To button */
|
||||
HWND hApplicationPageNewTaskButton; /* Application New Task button */
|
||||
static int nApplicationPageWidth;
|
||||
static int nApplicationPageHeight;
|
||||
|
||||
static HANDLE hApplicationPageEvent = NULL; // When this event becomes signaled then we refresh the app list
|
||||
|
||||
static HANDLE hApplicationPageEvent = NULL; /* When this event becomes signaled then we refresh the app list */
|
||||
static BOOL bSortAscending = TRUE;
|
||||
|
||||
void ApplicationPageRefreshThread(void *lpParameter);
|
||||
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
|
||||
void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung);
|
||||
|
@ -65,10 +60,12 @@ void ApplicationPageShowContextMenu1(void);
|
|||
void ApplicationPageShowContextMenu2(void);
|
||||
int CALLBACK ApplicationPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
|
||||
|
||||
//void SwitchToThisWindow (
|
||||
//HWND hWnd, // Handle to the window that should be activated
|
||||
//BOOL bRestore // Restore the window if it is minimized
|
||||
//);
|
||||
#if 0
|
||||
void SwitchToThisWindow (
|
||||
HWND hWnd, /* Handle to the window that should be activated */
|
||||
BOOL bRestore /* Restore the window if it is minimized */
|
||||
);
|
||||
#endif
|
||||
|
||||
LRESULT CALLBACK ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
@ -82,15 +79,15 @@ LRESULT CALLBACK ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam,
|
|||
switch (message) {
|
||||
case WM_INITDIALOG:
|
||||
|
||||
// Save the width and height
|
||||
/* Save the width and height */
|
||||
GetClientRect(hDlg, &rc);
|
||||
nApplicationPageWidth = rc.right;
|
||||
nApplicationPageHeight = rc.bottom;
|
||||
|
||||
// Update window position
|
||||
/* Update window position */
|
||||
SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
|
||||
|
||||
// Get handles to the controls
|
||||
/* Get handles to the controls */
|
||||
hApplicationPageListCtrl = GetDlgItem(hDlg, IDC_APPLIST);
|
||||
hApplicationPageEndTaskButton = GetDlgItem(hDlg, IDC_ENDTASK);
|
||||
hApplicationPageSwitchToButton = GetDlgItem(hDlg, IDC_SWITCHTO);
|
||||
|
@ -98,37 +95,37 @@ LRESULT CALLBACK ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam,
|
|||
|
||||
SetWindowText(hApplicationPageListCtrl, _T("Tasks"));
|
||||
|
||||
// Initialize the application page's controls
|
||||
/* Initialize the application page's controls */
|
||||
column.mask = LVCF_TEXT|LVCF_WIDTH;
|
||||
_tcscpy(szTemp, _T("Task"));
|
||||
column.pszText = szTemp;
|
||||
column.cx = 250;
|
||||
ListView_InsertColumn(hApplicationPageListCtrl, 0, &column); // Add the "Task" column
|
||||
ListView_InsertColumn(hApplicationPageListCtrl, 0, &column); /* Add the "Task" column */
|
||||
column.mask = LVCF_TEXT|LVCF_WIDTH;
|
||||
_tcscpy(szTemp, _T("Status"));
|
||||
column.pszText = szTemp;
|
||||
column.cx = 95;
|
||||
ListView_InsertColumn(hApplicationPageListCtrl, 1, &column); // Add the "Status" column
|
||||
ListView_InsertColumn(hApplicationPageListCtrl, 1, &column); /* Add the "Status" column */
|
||||
|
||||
ListView_SetImageList(hApplicationPageListCtrl, ImageList_Create(16, 16, ILC_COLOR8|ILC_MASK, 0, 1), LVSIL_SMALL);
|
||||
ListView_SetImageList(hApplicationPageListCtrl, ImageList_Create(32, 32, ILC_COLOR8|ILC_MASK, 0, 1), LVSIL_NORMAL);
|
||||
|
||||
UpdateApplicationListControlViewSetting();
|
||||
|
||||
// Start our refresh thread
|
||||
/* Start our refresh thread */
|
||||
_beginthread(ApplicationPageRefreshThread, 0, NULL);
|
||||
|
||||
return TRUE;
|
||||
|
||||
case WM_DESTROY:
|
||||
// Close the event handle, this will make the
|
||||
// refresh thread exit when the wait fails
|
||||
/* Close the event handle, this will make the */
|
||||
/* refresh thread exit when the wait fails */
|
||||
CloseHandle(hApplicationPageEvent);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
|
||||
// Handle the button clicks
|
||||
/* Handle the button clicks */
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_ENDTASK:
|
||||
|
@ -155,7 +152,7 @@ LRESULT CALLBACK ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam,
|
|||
nApplicationPageWidth = cx;
|
||||
nApplicationPageHeight = cy;
|
||||
|
||||
// Reposition the application page's controls
|
||||
/* Reposition the application page's controls */
|
||||
GetWindowRect(hApplicationPageListCtrl, &rc);
|
||||
cx = (rc.right - rc.left) + nXDifference;
|
||||
cy = (rc.bottom - rc.top) + nYDifference;
|
||||
|
@ -196,8 +193,8 @@ LRESULT CALLBACK ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam,
|
|||
|
||||
void RefreshApplicationPage(void)
|
||||
{
|
||||
// Signal the event so that our refresh thread
|
||||
// will wake up and refresh the application page
|
||||
/* Signal the event so that our refresh thread */
|
||||
/* will wake up and refresh the application page */
|
||||
SetEvent(hApplicationPageEvent);
|
||||
}
|
||||
|
||||
|
@ -224,10 +221,10 @@ void UpdateApplicationListControlViewSetting(void)
|
|||
|
||||
void ApplicationPageRefreshThread(void *lpParameter)
|
||||
{
|
||||
// Create the event
|
||||
/* Create the event */
|
||||
hApplicationPageEvent = CreateEvent(NULL, TRUE, TRUE, _T("Application Page Event"));
|
||||
|
||||
// If we couldn't create the event then exit the thread
|
||||
/* If we couldn't create the event then exit the thread */
|
||||
if (!hApplicationPageEvent)
|
||||
return;
|
||||
|
||||
|
@ -235,17 +232,17 @@ void ApplicationPageRefreshThread(void *lpParameter)
|
|||
{
|
||||
DWORD dwWaitVal;
|
||||
|
||||
// Wait on the event
|
||||
/* Wait on the event */
|
||||
dwWaitVal = WaitForSingleObject(hApplicationPageEvent, INFINITE);
|
||||
|
||||
// If the wait failed then the event object must have been
|
||||
// closed and the task manager is exiting so exit this thread
|
||||
/* If the wait failed then the event object must have been */
|
||||
/* closed and the task manager is exiting so exit this thread */
|
||||
if (dwWaitVal == WAIT_FAILED)
|
||||
return;
|
||||
|
||||
if (dwWaitVal == WAIT_OBJECT_0)
|
||||
{
|
||||
// Reset our event
|
||||
/* Reset our event */
|
||||
ResetEvent(hApplicationPageEvent);
|
||||
|
||||
/*
|
||||
|
@ -268,25 +265,25 @@ BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
|
|||
IsHungAppWindowProc IsHungAppWindow;
|
||||
|
||||
|
||||
// Skip our window
|
||||
/* Skip our window */
|
||||
if (hWnd == hMainWnd)
|
||||
return TRUE;
|
||||
|
||||
bLargeIcon = TaskManagerSettings.View_LargeIcons ? TRUE : FALSE;
|
||||
|
||||
GetWindowText(hWnd, szText, 260); // Get the window text
|
||||
GetWindowText(hWnd, szText, 260); /* Get the window text */
|
||||
|
||||
// Check and see if this is a top-level app window
|
||||
/* Check and see if this is a top-level app window */
|
||||
if ((_tcslen(szText) <= 0) ||
|
||||
!IsWindowVisible(hWnd) ||
|
||||
(GetParent(hWnd) != NULL) ||
|
||||
(GetWindow(hWnd, GW_OWNER) != NULL) ||
|
||||
(GetWindowLong(hWnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW))
|
||||
{
|
||||
return TRUE; // Skip this window
|
||||
return TRUE; /* Skip this window */
|
||||
}
|
||||
|
||||
// Get the icon for this window
|
||||
/* Get the icon for this window */
|
||||
hIcon = NULL;
|
||||
SendMessageTimeout(hWnd, WM_GETICON, bLargeIcon ? ICON_BIG /*1*/ : ICON_SMALL /*0*/, 0, 0, 1000, (unsigned long*)&hIcon);
|
||||
|
||||
|
@ -303,8 +300,8 @@ BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
|
|||
|
||||
bHung = FALSE;
|
||||
|
||||
//IsHungAppWindow = (IsHungAppWindowProc)(FARPROC)GetProcAddress(GetModuleHandle(_T("USER32.DLL")), _T("IsHungAppWindow"));
|
||||
//IsHungAppWindow = (IsHungAppWindowProc)(FARPROC)GetProcAddress(GetModuleHandle("USER32.DLL"), _T("IsHungAppWindow"));
|
||||
/*IsHungAppWindow = */(IsHungAppWindowProc)(FARPROC)GetProcAddress(GetModuleHandle(_T("USER32.DLL")), _T("IsHungAppWindow"));
|
||||
/*IsHungAppWindow = */ (IsHungAppWindowProc)(FARPROC)GetProcAddress(GetModuleHandle("USER32.DLL"), _T("IsHungAppWindow"));
|
||||
IsHungAppWindow = (IsHungAppWindowProc)(FARPROC)GetProcAddress(GetModuleHandle(_T("USER32.DLL")), "IsHungAppWindow");
|
||||
|
||||
if (IsHungAppWindow)
|
||||
|
@ -327,11 +324,11 @@ void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung)
|
|||
|
||||
memset(&item, 0, sizeof(LV_ITEM));
|
||||
|
||||
// Get the image lists
|
||||
/* Get the image lists */
|
||||
hImageListLarge = ListView_GetImageList(hApplicationPageListCtrl, LVSIL_NORMAL);
|
||||
hImageListSmall = ListView_GetImageList(hApplicationPageListCtrl, LVSIL_SMALL);
|
||||
|
||||
// Check to see if it's already in our list
|
||||
/* Check to see if it's already in our list */
|
||||
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++)
|
||||
{
|
||||
memset(&item, 0, sizeof(LV_ITEM));
|
||||
|
@ -347,33 +344,33 @@ void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung)
|
|||
}
|
||||
}
|
||||
|
||||
// If it is already in the list then update it if necessary
|
||||
/* If it is already in the list then update it if necessary */
|
||||
if (bAlreadyInList)
|
||||
{
|
||||
// Check to see if anything needs updating
|
||||
/* Check to see if anything needs updating */
|
||||
if ((pAPLI->hIcon != hIcon) ||
|
||||
(_tcsicmp(pAPLI->szTitle, szTitle) != 0) ||
|
||||
(pAPLI->bHung != bHung))
|
||||
{
|
||||
// Update the structure
|
||||
/* Update the structure */
|
||||
pAPLI->hIcon = hIcon;
|
||||
pAPLI->bHung = bHung;
|
||||
_tcscpy(pAPLI->szTitle, szTitle);
|
||||
|
||||
// Update the image list
|
||||
/* Update the image list */
|
||||
ImageList_ReplaceIcon(hImageListLarge, item.iItem, hIcon);
|
||||
ImageList_ReplaceIcon(hImageListSmall, item.iItem, hIcon);
|
||||
|
||||
// Update the list view
|
||||
/* Update the list view */
|
||||
ListView_RedrawItems(hApplicationPageListCtrl, 0, ListView_GetItemCount(hApplicationPageListCtrl));
|
||||
//UpdateWindow(hApplicationPageListCtrl);
|
||||
/* UpdateWindow(hApplicationPageListCtrl); */
|
||||
InvalidateRect(hApplicationPageListCtrl, NULL, 0);
|
||||
}
|
||||
}
|
||||
// It is not already in the list so add it
|
||||
/* It is not already in the list so add it */
|
||||
else
|
||||
{
|
||||
//pAPLI = new APPLICATION_PAGE_LIST_ITEM;
|
||||
/* pAPLI = new APPLICATION_PAGE_LIST_ITEM; */
|
||||
pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)malloc(sizeof(APPLICATION_PAGE_LIST_ITEM));
|
||||
|
||||
pAPLI->hWnd = hWnd;
|
||||
|
@ -381,7 +378,7 @@ void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung)
|
|||
pAPLI->bHung = bHung;
|
||||
_tcscpy(pAPLI->szTitle, szTitle);
|
||||
|
||||
// Add the item to the list
|
||||
/* Add the item to the list */
|
||||
memset(&item, 0, sizeof(LV_ITEM));
|
||||
item.mask = LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM;
|
||||
ImageList_AddIcon(hImageListLarge, hIcon);
|
||||
|
@ -393,7 +390,7 @@ void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung)
|
|||
}
|
||||
|
||||
|
||||
// Check to see if we need to remove any items from the list
|
||||
/* Check to see if we need to remove any items from the list */
|
||||
for (i=ListView_GetItemCount(hApplicationPageListCtrl)-1; i>=0; i--)
|
||||
{
|
||||
memset(&item, 0, sizeof(LV_ITEM));
|
||||
|
@ -413,17 +410,17 @@ void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung)
|
|||
ImageList_Remove(hImageListSmall, item.iItem);
|
||||
|
||||
ListView_DeleteItem(hApplicationPageListCtrl, item.iItem);
|
||||
//delete pAPLI;
|
||||
/* delete pAPLI; */
|
||||
free(pAPLI);
|
||||
bItemRemoved = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// If an item was removed from the list then
|
||||
// we need to resync all the items with the
|
||||
// image list
|
||||
//
|
||||
/*
|
||||
* If an item was removed from the list then
|
||||
* we need to resync all the items with the
|
||||
* image list
|
||||
*/
|
||||
if (bItemRemoved)
|
||||
{
|
||||
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++)
|
||||
|
@ -441,7 +438,7 @@ void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung)
|
|||
|
||||
void ApplicationPageUpdate(void)
|
||||
{
|
||||
// Enable or disable the "End Task" & "Switch To" buttons
|
||||
/* Enable or disable the "End Task" & "Switch To" buttons */
|
||||
if (ListView_GetSelectedCount(hApplicationPageListCtrl))
|
||||
{
|
||||
EnableWindow(hApplicationPageEndTaskButton, TRUE);
|
||||
|
@ -453,8 +450,8 @@ void ApplicationPageUpdate(void)
|
|||
EnableWindow(hApplicationPageSwitchToButton, FALSE);
|
||||
}
|
||||
|
||||
// If we are on the applications tab the the windows menu will
|
||||
// be present on the menu bar so enable & disable the menu items
|
||||
/* If we are on the applications tab the the windows menu will */
|
||||
/* be present on the menu bar so enable & disable the menu items */
|
||||
if (TabCtrl_GetCurSel(hTabWnd) == 0)
|
||||
{
|
||||
HMENU hMenu;
|
||||
|
@ -463,7 +460,7 @@ void ApplicationPageUpdate(void)
|
|||
hMenu = GetMenu(hMainWnd);
|
||||
hWindowsMenu = GetSubMenu(hMenu, 3);
|
||||
|
||||
// Only one item selected
|
||||
/* Only one item selected */
|
||||
if (ListView_GetSelectedCount(hApplicationPageListCtrl) == 1)
|
||||
{
|
||||
EnableMenuItem(hWindowsMenu, ID_WINDOWS_TILEHORIZONTALLY, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
|
||||
|
@ -473,7 +470,7 @@ void ApplicationPageUpdate(void)
|
|||
EnableMenuItem(hWindowsMenu, ID_WINDOWS_CASCADE, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
|
||||
EnableMenuItem(hWindowsMenu, ID_WINDOWS_BRINGTOFRONT, MF_BYCOMMAND|MF_ENABLED);
|
||||
}
|
||||
// More than one item selected
|
||||
/* More than one item selected */
|
||||
else if (ListView_GetSelectedCount(hApplicationPageListCtrl) > 1)
|
||||
{
|
||||
EnableMenuItem(hWindowsMenu, ID_WINDOWS_TILEHORIZONTALLY, MF_BYCOMMAND|MF_ENABLED);
|
||||
|
@ -483,7 +480,7 @@ void ApplicationPageUpdate(void)
|
|||
EnableMenuItem(hWindowsMenu, ID_WINDOWS_CASCADE, MF_BYCOMMAND|MF_ENABLED);
|
||||
EnableMenuItem(hWindowsMenu, ID_WINDOWS_BRINGTOFRONT, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
|
||||
}
|
||||
// No items selected
|
||||
/* No items selected */
|
||||
else
|
||||
{
|
||||
EnableMenuItem(hWindowsMenu, ID_WINDOWS_TILEHORIZONTALLY, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
|
||||
|
@ -519,13 +516,13 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
|
|||
case LVN_GETDISPINFO:
|
||||
pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)pnmdi->item.lParam;
|
||||
|
||||
// Update the item text
|
||||
/* Update the item text */
|
||||
if (pnmdi->item.iSubItem == 0)
|
||||
{
|
||||
_tcsncpy(pnmdi->item.pszText, pAPLI->szTitle, pnmdi->item.cchTextMax);
|
||||
}
|
||||
|
||||
// Update the item status
|
||||
/* Update the item status */
|
||||
else if (pnmdi->item.iSubItem == 1)
|
||||
{
|
||||
if (pAPLI->bHung)
|
||||
|
@ -729,7 +726,7 @@ void ApplicationPage_OnWindowsTileHorizontally(void)
|
|||
}
|
||||
}
|
||||
TileWindows(NULL, MDITILE_HORIZONTAL, NULL, nWndCount, hWndArray);
|
||||
//delete[] hWndArray;
|
||||
/* delete[] hWndArray; */
|
||||
free(hWndArray);
|
||||
}
|
||||
|
||||
|
@ -741,7 +738,7 @@ void ApplicationPage_OnWindowsTileVertically(void)
|
|||
HWND* hWndArray;
|
||||
int nWndCount;
|
||||
|
||||
//hWndArray = new HWND[ListView_GetItemCount(hApplicationPageListCtrl)];
|
||||
/* hWndArray = new HWND[ListView_GetItemCount(hApplicationPageListCtrl)]; */
|
||||
hWndArray = (HWND*)malloc(sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
|
||||
nWndCount = 0;
|
||||
|
||||
|
@ -762,7 +759,7 @@ void ApplicationPage_OnWindowsTileVertically(void)
|
|||
}
|
||||
|
||||
TileWindows(NULL, MDITILE_VERTICAL, NULL, nWndCount, hWndArray);
|
||||
//delete[] hWndArray;
|
||||
/* delete[] hWndArray; */
|
||||
free(hWndArray);
|
||||
}
|
||||
|
||||
|
@ -816,7 +813,7 @@ void ApplicationPage_OnWindowsCascade(void)
|
|||
HWND* hWndArray;
|
||||
int nWndCount;
|
||||
|
||||
//hWndArray = new HWND[ListView_GetItemCount(hApplicationPageListCtrl)];
|
||||
/* hWndArray = new HWND[ListView_GetItemCount(hApplicationPageListCtrl)]; */
|
||||
hWndArray = (HWND*)malloc(sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
|
||||
nWndCount = 0;
|
||||
|
||||
|
@ -835,7 +832,7 @@ void ApplicationPage_OnWindowsCascade(void)
|
|||
}
|
||||
}
|
||||
CascadeWindows(NULL, 0, NULL, nWndCount, hWndArray);
|
||||
//delete[] hWndArray;
|
||||
/* delete[] hWndArray; */
|
||||
free(hWndArray);
|
||||
}
|
||||
|
||||
|
@ -926,7 +923,7 @@ void ApplicationPage_OnGotoProcess(void)
|
|||
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
|
||||
LV_ITEM item;
|
||||
int i;
|
||||
//NMHDR nmhdr;
|
||||
/* NMHDR nmhdr; */
|
||||
|
||||
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
|
||||
memset(&item, 0, sizeof(LV_ITEM));
|
||||
|
@ -943,13 +940,13 @@ void ApplicationPage_OnGotoProcess(void)
|
|||
DWORD dwProcessId;
|
||||
|
||||
GetWindowThreadProcessId(pAPLI->hWnd, &dwProcessId);
|
||||
//
|
||||
// Switch to the process tab
|
||||
//
|
||||
/*
|
||||
* Switch to the process tab
|
||||
*/
|
||||
TabCtrl_SetCurFocus(hTabWnd, 1);
|
||||
//
|
||||
// FIXME: Select the process item in the list
|
||||
//
|
||||
/*
|
||||
* FIXME: Select the process item in the list
|
||||
*/
|
||||
for (i=0; i<ListView_GetItemCount(hProcessPage); i++) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -130,7 +130,7 @@ void SaveColumnSettings(void)
|
|||
TCHAR text[260];
|
||||
int size;
|
||||
|
||||
// Reset column data
|
||||
/* Reset column data */
|
||||
for (i=0; i<25; i++)
|
||||
TaskManagerSettings.ColumnOrderArray[i] = i;
|
||||
|
||||
|
@ -185,11 +185,11 @@ void SaveColumnSettings(void)
|
|||
TaskManagerSettings.ColumnSizeArray[23] = 70;
|
||||
TaskManagerSettings.ColumnSizeArray[24] = 70;
|
||||
|
||||
// Get header order
|
||||
/* Get header order */
|
||||
size = SendMessage(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0);
|
||||
SendMessage(hProcessPageHeaderCtrl, HDM_GETORDERARRAY, (WPARAM) size, (LPARAM) &TaskManagerSettings.ColumnOrderArray);
|
||||
|
||||
// Get visible columns
|
||||
/* Get visible columns */
|
||||
for (i=0; i<SendMessage(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0); i++) {
|
||||
memset(&hditem, 0, sizeof(HDITEM));
|
||||
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -54,10 +54,10 @@ LRESULT CALLBACK Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
|
|||
|
||||
return TRUE;
|
||||
|
||||
//
|
||||
// Filter out mouse & keyboard messages
|
||||
//
|
||||
//case WM_APPCOMMAND:
|
||||
/*
|
||||
* Filter out mouse & keyboard messages
|
||||
*/
|
||||
/* case WM_APPCOMMAND: */
|
||||
case WM_CAPTURECHANGED:
|
||||
case WM_LBUTTONDBLCLK:
|
||||
case WM_LBUTTONDOWN:
|
||||
|
@ -69,7 +69,7 @@ LRESULT CALLBACK Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
|
|||
case WM_MOUSEHOVER:
|
||||
case WM_MOUSELEAVE:
|
||||
case WM_MOUSEMOVE:
|
||||
//case WM_MOUSEWHEEL:
|
||||
/* case WM_MOUSEWHEEL: */
|
||||
case WM_NCHITTEST:
|
||||
case WM_NCLBUTTONDBLCLK:
|
||||
case WM_NCLBUTTONDOWN:
|
||||
|
@ -77,21 +77,21 @@ LRESULT CALLBACK Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
|
|||
case WM_NCMBUTTONDBLCLK:
|
||||
case WM_NCMBUTTONDOWN:
|
||||
case WM_NCMBUTTONUP:
|
||||
//case WM_NCMOUSEHOVER:
|
||||
//case WM_NCMOUSELEAVE:
|
||||
/* case WM_NCMOUSEHOVER: */
|
||||
/* case WM_NCMOUSELEAVE: */
|
||||
case WM_NCMOUSEMOVE:
|
||||
case WM_NCRBUTTONDBLCLK:
|
||||
case WM_NCRBUTTONDOWN:
|
||||
case WM_NCRBUTTONUP:
|
||||
//case WM_NCXBUTTONDBLCLK:
|
||||
//case WM_NCXBUTTONDOWN:
|
||||
//case WM_NCXBUTTONUP:
|
||||
/* case WM_NCXBUTTONDBLCLK: */
|
||||
/* case WM_NCXBUTTONDOWN: */
|
||||
/* case WM_NCXBUTTONUP: */
|
||||
case WM_RBUTTONDBLCLK:
|
||||
case WM_RBUTTONDOWN:
|
||||
case WM_RBUTTONUP:
|
||||
//case WM_XBUTTONDBLCLK:
|
||||
//case WM_XBUTTONDOWN:
|
||||
//case WM_XBUTTONUP:
|
||||
/* case WM_XBUTTONDBLCLK: */
|
||||
/* case WM_XBUTTONDOWN: */
|
||||
/* case WM_XBUTTONUP: */
|
||||
case WM_ACTIVATE:
|
||||
case WM_CHAR:
|
||||
case WM_DEADCHAR:
|
||||
|
@ -135,9 +135,9 @@ LRESULT CALLBACK Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
|
|||
|
||||
}
|
||||
|
||||
//
|
||||
// We pass on all non-handled messages
|
||||
//
|
||||
/*
|
||||
* We pass on all non-handled messages
|
||||
*/
|
||||
return CallWindowProc((WNDPROC)OldGraphWndProc, hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
|
@ -150,24 +150,27 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
|
|||
ULONG CpuUsage;
|
||||
ULONG CpuKernelUsage;
|
||||
int nBars;
|
||||
int nBarsUsed; // Bottom bars that are "used", i.e. are bright green, representing used cpu time
|
||||
int nBarsUsedKernel; // Bottom bars that are "used", i.e. are bright green, representing used cpu kernel time
|
||||
int nBarsFree; // Top bars that are "unused", i.e. are dark green, representing free cpu time
|
||||
int nBarsUsed;
|
||||
/* Bottom bars that are "used", i.e. are bright green, representing used cpu time */
|
||||
int nBarsUsedKernel;
|
||||
/* Bottom bars that are "used", i.e. are bright green, representing used cpu kernel time */
|
||||
int nBarsFree;
|
||||
/* Top bars that are "unused", i.e. are dark green, representing free cpu time */
|
||||
int i;
|
||||
|
||||
//
|
||||
// Get the client area rectangle
|
||||
//
|
||||
/*
|
||||
* Get the client area rectangle
|
||||
*/
|
||||
GetClientRect(hWnd, &rcClient);
|
||||
|
||||
//
|
||||
// Fill it with blackness
|
||||
//
|
||||
/*
|
||||
* Fill it with blackness
|
||||
*/
|
||||
FillSolidRect(hDC, &rcClient, RGB(0, 0, 0));
|
||||
|
||||
//
|
||||
// Get the CPU usage
|
||||
//
|
||||
/*
|
||||
* Get the CPU usage
|
||||
*/
|
||||
CpuUsage = PerfDataGetProcessorUsage();
|
||||
CpuKernelUsage = PerfDataGetProcessorSystemUsage();
|
||||
if (CpuUsage < 0) CpuUsage = 0;
|
||||
|
@ -175,10 +178,10 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
|
|||
if (CpuKernelUsage < 0) CpuKernelUsage = 0;
|
||||
if (CpuKernelUsage > 100) CpuKernelUsage = 100;
|
||||
|
||||
//
|
||||
// Check and see how many digits it will take
|
||||
// so we get the indentation right every time.
|
||||
//
|
||||
/*
|
||||
* Check and see how many digits it will take
|
||||
* so we get the indentation right every time.
|
||||
*/
|
||||
if (CpuUsage == 100)
|
||||
{
|
||||
_stprintf(Text, _T("%d%%"), (int)CpuUsage);
|
||||
|
@ -192,16 +195,16 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
|
|||
_stprintf(Text, _T(" %d%%"), (int)CpuUsage);
|
||||
}
|
||||
|
||||
//
|
||||
// Draw the font text onto the graph
|
||||
// The bottom 20 pixels are reserved for the text
|
||||
//
|
||||
/*
|
||||
* Draw the font text onto the graph
|
||||
* The bottom 20 pixels are reserved for the text
|
||||
*/
|
||||
Font_DrawText(hDC, Text, ((rcClient.right - rcClient.left) - 32) / 2, rcClient.bottom - 11 - 5);
|
||||
|
||||
//
|
||||
// Now we have to draw the graph
|
||||
// So first find out how many bars we can fit
|
||||
//
|
||||
/*
|
||||
* Now we have to draw the graph
|
||||
* So first find out how many bars we can fit
|
||||
*/
|
||||
nBars = ((rcClient.bottom - rcClient.top) - 25) / 3;
|
||||
nBarsUsed = (nBars * CpuUsage) / 100;
|
||||
if ((CpuUsage) && (nBarsUsed == 0))
|
||||
|
@ -219,9 +222,9 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
|
|||
nBarsUsedKernel = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Now draw the bar graph
|
||||
//
|
||||
/*
|
||||
* Now draw the bar graph
|
||||
*/
|
||||
rcBarLeft.left = ((rcClient.right - rcClient.left) - 33) / 2;
|
||||
rcBarLeft.right = rcBarLeft.left + 16;
|
||||
rcBarRight.left = rcBarLeft.left + 17;
|
||||
|
@ -238,9 +241,9 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
|
|||
if (nBarsUsedKernel < 0) nBarsUsedKernel = 0;
|
||||
if (nBarsUsedKernel > nBars) nBarsUsedKernel = nBars;
|
||||
|
||||
//
|
||||
// Draw the "free" bars
|
||||
//
|
||||
/*
|
||||
* Draw the "free" bars
|
||||
*/
|
||||
for (i=0; i<nBarsFree; i++)
|
||||
{
|
||||
FillSolidRect(hDC, &rcBarLeft, DARK_GREEN);
|
||||
|
@ -253,9 +256,9 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
|
|||
rcBarRight.bottom += 3;
|
||||
}
|
||||
|
||||
//
|
||||
// Draw the "used" bars
|
||||
//
|
||||
/*
|
||||
* Draw the "used" bars
|
||||
*/
|
||||
for (i=0; i<nBarsUsed; i++)
|
||||
{
|
||||
if (nBarsUsed > 5000) nBarsUsed = 5000;
|
||||
|
@ -270,9 +273,9 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
|
|||
rcBarRight.bottom += 3;
|
||||
}
|
||||
|
||||
//
|
||||
// Draw the "used" kernel bars
|
||||
//
|
||||
/*
|
||||
* Draw the "used" kernel bars
|
||||
*/
|
||||
rcBarLeft.bottom--;
|
||||
rcBarRight.bottom--;
|
||||
if (nBarsUsedKernel && nBarsUsedKernel % 2)
|
||||
|
@ -327,38 +330,40 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
|
|||
ULONGLONG CommitChargeTotal;
|
||||
ULONGLONG CommitChargeLimit;
|
||||
int nBars;
|
||||
int nBarsUsed; // Bottom bars that are "used", i.e. are bright green, representing used memory
|
||||
int nBarsFree; // Top bars that are "unused", i.e. are dark green, representing free memory
|
||||
int nBarsUsed;
|
||||
/* Bottom bars that are "used", i.e. are bright green, representing used memory */
|
||||
int nBarsFree;
|
||||
/* Top bars that are "unused", i.e. are dark green, representing free memory */
|
||||
int i;
|
||||
|
||||
//
|
||||
// Get the client area rectangle
|
||||
//
|
||||
/*
|
||||
* Get the client area rectangle
|
||||
*/
|
||||
GetClientRect(hWnd, &rcClient);
|
||||
|
||||
//
|
||||
// Fill it with blackness
|
||||
//
|
||||
/*
|
||||
* Fill it with blackness
|
||||
*/
|
||||
FillSolidRect(hDC, &rcClient, RGB(0, 0, 0));
|
||||
|
||||
//
|
||||
// Get the memory usage
|
||||
//
|
||||
/*
|
||||
* Get the memory usage
|
||||
*/
|
||||
CommitChargeTotal = (ULONGLONG)PerfDataGetCommitChargeTotalK();
|
||||
CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
|
||||
|
||||
_stprintf(Text, _T("%dK"), (int)CommitChargeTotal);
|
||||
|
||||
//
|
||||
// Draw the font text onto the graph
|
||||
// The bottom 20 pixels are reserved for the text
|
||||
//
|
||||
/*
|
||||
* Draw the font text onto the graph
|
||||
* The bottom 20 pixels are reserved for the text
|
||||
*/
|
||||
Font_DrawText(hDC, Text, ((rcClient.right - rcClient.left) - (_tcslen(Text) * 8)) / 2, rcClient.bottom - 11 - 5);
|
||||
|
||||
//
|
||||
// Now we have to draw the graph
|
||||
// So first find out how many bars we can fit
|
||||
//
|
||||
/*
|
||||
* Now we have to draw the graph
|
||||
* So first find out how many bars we can fit
|
||||
*/
|
||||
nBars = ((rcClient.bottom - rcClient.top) - 25) / 3;
|
||||
nBarsUsed = (nBars * (int)((CommitChargeTotal * 100) / CommitChargeLimit)) / 100;
|
||||
nBarsFree = nBars - nBarsUsed;
|
||||
|
@ -369,9 +374,9 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
|
|||
if (nBarsFree < 0) nBarsFree = 0;
|
||||
if (nBarsFree > nBars) nBarsFree = nBars;
|
||||
|
||||
//
|
||||
// Now draw the bar graph
|
||||
//
|
||||
/*
|
||||
* Now draw the bar graph
|
||||
*/
|
||||
rcBarLeft.left = ((rcClient.right - rcClient.left) - 33) / 2;
|
||||
rcBarLeft.right = rcBarLeft.left + 16;
|
||||
rcBarRight.left = rcBarLeft.left + 17;
|
||||
|
@ -379,9 +384,9 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
|
|||
rcBarLeft.top = rcBarRight.top = 5;
|
||||
rcBarLeft.bottom = rcBarRight.bottom = 7;
|
||||
|
||||
//
|
||||
// Draw the "free" bars
|
||||
//
|
||||
/*
|
||||
* Draw the "free" bars
|
||||
*/
|
||||
for (i=0; i<nBarsFree; i++)
|
||||
{
|
||||
FillSolidRect(hDC, &rcBarLeft, DARK_GREEN);
|
||||
|
@ -394,9 +399,9 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
|
|||
rcBarRight.bottom += 3;
|
||||
}
|
||||
|
||||
//
|
||||
// Draw the "used" bars
|
||||
//
|
||||
/*
|
||||
* Draw the "used" bars
|
||||
*/
|
||||
for (i=0; i<nBarsUsed; i++)
|
||||
{
|
||||
FillSolidRect(hDC, &rcBarLeft, BRIGHT_GREEN);
|
||||
|
@ -420,47 +425,47 @@ void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd)
|
|||
if (offset++ >= 10)
|
||||
offset = 0;
|
||||
|
||||
//
|
||||
// Get the client area rectangle
|
||||
//
|
||||
/*
|
||||
* Get the client area rectangle
|
||||
*/
|
||||
GetClientRect(hWnd, &rcClient);
|
||||
|
||||
//
|
||||
// Fill it with blackness
|
||||
//
|
||||
/*
|
||||
* Fill it with blackness
|
||||
*/
|
||||
FillSolidRect(hDC, &rcClient, RGB(0, 0, 0));
|
||||
|
||||
//
|
||||
// Get the memory usage
|
||||
//
|
||||
/*
|
||||
* Get the memory usage
|
||||
*/
|
||||
CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
|
||||
|
||||
//
|
||||
// Draw the graph background
|
||||
//
|
||||
// Draw the horizontal bars
|
||||
//
|
||||
/*
|
||||
* Draw the graph background
|
||||
*
|
||||
* Draw the horizontal bars
|
||||
*/
|
||||
for (i=0; i<rcClient.bottom; i++)
|
||||
{
|
||||
if ((i % 11) == 0)
|
||||
{
|
||||
// FillSolidRect2(hDC, 0, i, rcClient.right, 1, DARK_GREEN);
|
||||
/* FillSolidRect2(hDC, 0, i, rcClient.right, 1, DARK_GREEN); */
|
||||
}
|
||||
}
|
||||
//
|
||||
// Draw the vertical bars
|
||||
//
|
||||
/*
|
||||
* Draw the vertical bars
|
||||
*/
|
||||
for (i=11; i<rcClient.right + offset; i++)
|
||||
{
|
||||
if ((i % 11) == 0)
|
||||
{
|
||||
// FillSolidRect2(hDC, i - offset, 0, 1, rcClient.bottom, DARK_GREEN);
|
||||
/* FillSolidRect2(hDC, i - offset, 0, 1, rcClient.bottom, DARK_GREEN); */
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw the memory usage
|
||||
//
|
||||
/*
|
||||
* Draw the memory usage
|
||||
*/
|
||||
for (i=rcClient.right; i>=0; i--)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -5,19 +5,19 @@
|
|||
*
|
||||
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
@ -62,23 +62,25 @@ TGraphCtrl::TGraphCtrl() :
|
|||
m_penPlot[2] = 0;
|
||||
m_penPlot[3] = 0;
|
||||
|
||||
// since plotting is based on a LineTo for each new point
|
||||
// we need a starting point (i.e. a "previous" point)
|
||||
// use 0.0 as the default first point.
|
||||
// these are public member variables, and can be changed outside
|
||||
// (after construction). Therefore m_perviousPosition could be set to
|
||||
// a more appropriate value prior to the first call to SetPosition.
|
||||
/* since plotting is based on a LineTo for each new point
|
||||
* we need a starting point (i.e. a "previous" point)
|
||||
* use 0.0 as the default first point.
|
||||
* these are public member variables, and can be changed outside
|
||||
* (after construction). Therefore m_perviousPosition could be set to
|
||||
* a more appropriate value prior to the first call to SetPosition.
|
||||
*/
|
||||
m_dPreviousPosition[0] = 0.0;
|
||||
m_dPreviousPosition[1] = 0.0;
|
||||
m_dPreviousPosition[2] = 0.0;
|
||||
m_dPreviousPosition[3] = 0.0;
|
||||
|
||||
// public variable for the number of decimal places on the y axis
|
||||
/* public variable for the number of decimal places on the y axis */
|
||||
m_nYDecimals = 3;
|
||||
|
||||
// set some initial values for the scaling until "SetRange" is called.
|
||||
// these are protected varaibles and must be set with SetRange
|
||||
// in order to ensure that m_dRange is updated accordingly
|
||||
/* set some initial values for the scaling until "SetRange" is called.
|
||||
* these are protected varaibles and must be set with SetRange
|
||||
* in order to ensure that m_dRange is updated accordingly
|
||||
*/
|
||||
// m_dLowerLimit = -10.0;
|
||||
// m_dUpperLimit = 10.0;
|
||||
m_dLowerLimit = 0.0;
|
||||
|
@ -100,14 +102,14 @@ TGraphCtrl::TGraphCtrl() :
|
|||
m_crPlotColor[2] = RGB(255, 100, 255); // see also SetPlotColor
|
||||
m_crPlotColor[3] = RGB(255, 255, 100); // see also SetPlotColor
|
||||
|
||||
// protected variables
|
||||
/* protected variables */
|
||||
int i;
|
||||
for (i = 0; i < MAX_PLOTS; i++) {
|
||||
m_penPlot[i] = CreatePen(PS_SOLID, 0, m_crPlotColor[i]);
|
||||
}
|
||||
m_brushBack = CreateSolidBrush(m_crBackColor);
|
||||
|
||||
// public member variables, can be set directly
|
||||
/* public member variables, can be set directly */
|
||||
strcpy(m_strXUnitsString, "Samples"); // can also be set with SetXUnits
|
||||
strcpy(m_strYUnitsString, "Y units"); // can also be set with SetYUnits
|
||||
|
||||
|
|
|
@ -5,28 +5,28 @@
|
|||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//
|
||||
// options.c
|
||||
//
|
||||
// Menu item handlers for the options menu.
|
||||
//
|
||||
/*
|
||||
* options.c
|
||||
*
|
||||
* Menu item handlers for the options menu.
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -50,10 +50,10 @@ void TaskManager_OnOptionsAlwaysOnTop(void)
|
|||
hMenu = GetMenu(hMainWnd);
|
||||
hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
|
||||
|
||||
//
|
||||
// Check or uncheck the always on top menu item
|
||||
// and update main window.
|
||||
//
|
||||
/*
|
||||
* Check or uncheck the always on top menu item
|
||||
* and update main window.
|
||||
*/
|
||||
if (GetMenuState(hOptionsMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND) & MF_CHECKED)
|
||||
{
|
||||
CheckMenuItem(hOptionsMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND|MF_UNCHECKED);
|
||||
|
@ -76,9 +76,9 @@ void TaskManager_OnOptionsMinimizeOnUse(void)
|
|||
hMenu = GetMenu(hMainWnd);
|
||||
hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
|
||||
|
||||
//
|
||||
// Check or uncheck the minimize on use menu item.
|
||||
//
|
||||
/*
|
||||
* Check or uncheck the minimize on use menu item.
|
||||
*/
|
||||
if (GetMenuState(hOptionsMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND) & MF_CHECKED)
|
||||
{
|
||||
CheckMenuItem(hOptionsMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_UNCHECKED);
|
||||
|
@ -99,9 +99,9 @@ void TaskManager_OnOptionsHideWhenMinimized(void)
|
|||
hMenu = GetMenu(hMainWnd);
|
||||
hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
|
||||
|
||||
//
|
||||
// Check or uncheck the hide when minimized menu item.
|
||||
//
|
||||
/*
|
||||
* Check or uncheck the hide when minimized menu item.
|
||||
*/
|
||||
if (GetMenuState(hOptionsMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND) & MF_CHECKED)
|
||||
{
|
||||
CheckMenuItem(hOptionsMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_UNCHECKED);
|
||||
|
@ -122,16 +122,16 @@ void TaskManager_OnOptionsShow16BitTasks(void)
|
|||
hMenu = GetMenu(hMainWnd);
|
||||
hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
|
||||
|
||||
//
|
||||
// FIXME: Currently this is useless because the
|
||||
// current implemetation doesn't list the 16-bit
|
||||
// processes. I believe that would require querying
|
||||
// each ntvdm.exe process for it's children.
|
||||
//
|
||||
/*
|
||||
* FIXME: Currently this is useless because the
|
||||
* current implemetation doesn't list the 16-bit
|
||||
* processes. I believe that would require querying
|
||||
* each ntvdm.exe process for it's children.
|
||||
*/
|
||||
|
||||
//
|
||||
// Check or uncheck the show 16-bit tasks menu item
|
||||
//
|
||||
/*
|
||||
* Check or uncheck the show 16-bit tasks menu item
|
||||
*/
|
||||
if (GetMenuState(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND) & MF_CHECKED)
|
||||
{
|
||||
CheckMenuItem(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_UNCHECKED);
|
||||
|
@ -143,8 +143,8 @@ void TaskManager_OnOptionsShow16BitTasks(void)
|
|||
TaskManagerSettings.Show16BitTasks = TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// Refresh the list of processes.
|
||||
//
|
||||
/*
|
||||
* Refresh the list of processes.
|
||||
*/
|
||||
RefreshProcessPage();
|
||||
}
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -36,9 +36,9 @@
|
|||
PROCNTQSI NtQuerySystemInformation = NULL;
|
||||
PROCGGR pGetGuiResources = NULL;
|
||||
PROCGPIC pGetProcessIoCounters = NULL;
|
||||
CRITICAL_SECTION PerfDataCriticalSection;
|
||||
PPERFDATA pPerfDataOld = NULL; // Older perf data (saved to establish delta values)
|
||||
PPERFDATA pPerfData = NULL; // Most recent copy of perf data
|
||||
CRITICAL_SECTION PerfDataCriticalSection;
|
||||
PPERFDATA pPerfDataOld = NULL; /* Older perf data (saved to establish delta values) */
|
||||
PPERFDATA pPerfData = NULL; /* Most recent copy of perf data */
|
||||
ULONG ProcessCountOld = 0;
|
||||
ULONG ProcessCount = 0;
|
||||
double dbIdleTime;
|
||||
|
@ -66,9 +66,9 @@ BOOL PerfDataInitialize(void)
|
|||
if (!NtQuerySystemInformation)
|
||||
return FALSE;
|
||||
|
||||
//
|
||||
// Get number of processors in the system
|
||||
//
|
||||
/*
|
||||
* Get number of processors in the system
|
||||
*/
|
||||
status = NtQuerySystemInformation(SystemBasicInformation, &SystemBasicInfo, sizeof(SystemBasicInfo), NULL);
|
||||
if (status != NO_ERROR)
|
||||
return FALSE;
|
||||
|
@ -107,31 +107,32 @@ void PerfDataRefresh(void)
|
|||
if (!NtQuerySystemInformation)
|
||||
return;
|
||||
|
||||
// Get new system time
|
||||
/* Get new system time */
|
||||
status = NtQuerySystemInformation(SystemTimeInformation, &SysTimeInfo, sizeof(SysTimeInfo), 0);
|
||||
if (status != NO_ERROR)
|
||||
return;
|
||||
|
||||
// Get new CPU's idle time
|
||||
/* Get new CPU's idle time */
|
||||
status = NtQuerySystemInformation(SystemPerformanceInformation, &SysPerfInfo, sizeof(SysPerfInfo), NULL);
|
||||
if (status != NO_ERROR)
|
||||
return;
|
||||
|
||||
// Get system cache information
|
||||
/* Get system cache information */
|
||||
status = NtQuerySystemInformation(SystemCacheInformation, &SysCacheInfo, sizeof(SysCacheInfo), NULL);
|
||||
if (status != NO_ERROR)
|
||||
return;
|
||||
|
||||
// Get processor time information
|
||||
/* Get processor time information */
|
||||
//SysProcessorTimeInfo = new SYSTEM_PROCESSORTIME_INFO[SystemBasicInfo.bKeNumberProcessors];
|
||||
SysProcessorTimeInfo = (PSYSTEM_PROCESSORTIME_INFO)malloc(sizeof(SYSTEM_PROCESSORTIME_INFO) * SystemBasicInfo.bKeNumberProcessors);
|
||||
status = NtQuerySystemInformation(SystemProcessorTimeInformation, SysProcessorTimeInfo, sizeof(SYSTEM_PROCESSORTIME_INFO) * SystemBasicInfo.bKeNumberProcessors, &ulSize);
|
||||
if (status != NO_ERROR)
|
||||
return;
|
||||
|
||||
// Get handle information
|
||||
// We don't know how much data there is so just keep
|
||||
// increasing the buffer size until the call succeeds
|
||||
/* Get handle information
|
||||
* We don't know how much data there is so just keep
|
||||
* increasing the buffer size until the call succeeds
|
||||
*/
|
||||
BufferSize = 0;
|
||||
do
|
||||
{
|
||||
|
@ -148,9 +149,10 @@ void PerfDataRefresh(void)
|
|||
|
||||
} while (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/);
|
||||
|
||||
// Get process information
|
||||
// We don't know how much data there is so just keep
|
||||
// increasing the buffer size until the call succeeds
|
||||
/* Get process information
|
||||
* We don't know how much data there is so just keep
|
||||
* increasing the buffer size until the call succeeds
|
||||
*/
|
||||
BufferSize = 0;
|
||||
do
|
||||
{
|
||||
|
@ -169,28 +171,28 @@ void PerfDataRefresh(void)
|
|||
|
||||
EnterCriticalSection(&PerfDataCriticalSection);
|
||||
|
||||
//
|
||||
// Save system performance info
|
||||
//
|
||||
/*
|
||||
* Save system performance info
|
||||
*/
|
||||
memcpy(&SystemPerfInfo, &SysPerfInfo, sizeof(SYSTEM_PERFORMANCE_INFORMATION));
|
||||
|
||||
//
|
||||
// Save system cache info
|
||||
//
|
||||
/*
|
||||
* Save system cache info
|
||||
*/
|
||||
memcpy(&SystemCacheInfo, &SysCacheInfo, sizeof(SYSTEM_CACHE_INFORMATION));
|
||||
|
||||
//
|
||||
// Save system processor time info
|
||||
//
|
||||
/*
|
||||
* Save system processor time info
|
||||
*/
|
||||
if (SystemProcessorTimeInfo) {
|
||||
//delete[] SystemProcessorTimeInfo;
|
||||
free(SystemProcessorTimeInfo);
|
||||
}
|
||||
SystemProcessorTimeInfo = SysProcessorTimeInfo;
|
||||
|
||||
//
|
||||
// Save system handle info
|
||||
//
|
||||
/*
|
||||
* Save system handle info
|
||||
*/
|
||||
memcpy(&SystemHandleInfo, SysHandleInfoData, sizeof(SYSTEM_HANDLE_INFORMATION));
|
||||
//delete[] SysHandleInfoData;
|
||||
free(SysHandleInfoData);
|
||||
|
@ -201,9 +203,9 @@ void PerfDataRefresh(void)
|
|||
CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].InterruptTime);
|
||||
}
|
||||
|
||||
// If it's a first call - skip idle time calcs
|
||||
/* If it's a first call - skip idle time calcs */
|
||||
if (liOldIdleTime.QuadPart != 0) {
|
||||
// CurrentValue = NewValue - OldValue
|
||||
// CurrentValue = NewValue - OldValue */
|
||||
dbIdleTime = Li2Double(SysPerfInfo.liIdleTime) - Li2Double(liOldIdleTime);
|
||||
dbKernelTime = CurrentKernelTime - OldKernelTime;
|
||||
dbSystemTime = Li2Double(SysTimeInfo.liKeSystemTime) - Li2Double(liOldSystemTime);
|
||||
|
@ -213,18 +215,19 @@ void PerfDataRefresh(void)
|
|||
dbKernelTime = dbKernelTime / dbSystemTime;
|
||||
|
||||
// CurrentCpuUsage% = 100 - (CurrentCpuIdle * 100) / NumberOfProcessors
|
||||
dbIdleTime = 100.0 - dbIdleTime * 100.0 / (double)SystemBasicInfo.bKeNumberProcessors;// + 0.5;
|
||||
dbKernelTime = 100.0 - dbKernelTime * 100.0 / (double)SystemBasicInfo.bKeNumberProcessors;// + 0.5;
|
||||
dbIdleTime = 100.0 - dbIdleTime * 100.0 / (double)SystemBasicInfo.bKeNumberProcessors; /* + 0.5; */
|
||||
dbKernelTime = 100.0 - dbKernelTime * 100.0 / (double)SystemBasicInfo.bKeNumberProcessors; /* + 0.5; */
|
||||
}
|
||||
|
||||
// Store new CPU's idle and system time
|
||||
/* Store new CPU's idle and system time */
|
||||
liOldIdleTime = SysPerfInfo.liIdleTime;
|
||||
liOldSystemTime = SysTimeInfo.liKeSystemTime;
|
||||
OldKernelTime = CurrentKernelTime;
|
||||
|
||||
// Determine the process count
|
||||
// We loop through the data we got from NtQuerySystemInformation
|
||||
// and count how many structures there are (until RelativeOffset is 0)
|
||||
/* Determine the process count
|
||||
* We loop through the data we got from NtQuerySystemInformation
|
||||
* and count how many structures there are (until RelativeOffset is 0)
|
||||
*/
|
||||
ProcessCountOld = ProcessCount;
|
||||
ProcessCount = 0;
|
||||
pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer;
|
||||
|
@ -235,7 +238,7 @@ void PerfDataRefresh(void)
|
|||
pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->RelativeOffset);
|
||||
}
|
||||
|
||||
// Now alloc a new PERFDATA array and fill in the data
|
||||
/* Now alloc a new PERFDATA array and fill in the data */
|
||||
if (pPerfDataOld) {
|
||||
//delete[] pPerfDataOld;
|
||||
free(pPerfDataOld);
|
||||
|
@ -245,8 +248,8 @@ void PerfDataRefresh(void)
|
|||
pPerfData = (PPERFDATA)malloc(sizeof(PERFDATA) * ProcessCount);
|
||||
pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer;
|
||||
for (Idx=0; Idx<ProcessCount; Idx++) {
|
||||
// Get the old perf data for this process (if any)
|
||||
// so that we can establish delta values
|
||||
/* Get the old perf data for this process (if any) */
|
||||
/* so that we can establish delta values */
|
||||
pPDOld = NULL;
|
||||
for (Idx2=0; Idx2<ProcessCountOld; Idx2++) {
|
||||
if (pPerfDataOld[Idx2].ProcessId == pSPI->ProcessId) {
|
||||
|
@ -255,7 +258,7 @@ void PerfDataRefresh(void)
|
|||
}
|
||||
}
|
||||
|
||||
// Clear out process perf data structure
|
||||
/* Clear out process perf data structure */
|
||||
memset(&pPerfData[Idx], 0, sizeof(PERFDATA));
|
||||
|
||||
if (pSPI->Name.Buffer)
|
||||
|
@ -269,7 +272,7 @@ void PerfDataRefresh(void)
|
|||
double CurTime = Li2Double(pSPI->KernelTime) + Li2Double(pSPI->UserTime);
|
||||
double OldTime = Li2Double(pPDOld->KernelTime) + Li2Double(pPDOld->UserTime);
|
||||
double CpuTime = (CurTime - OldTime) / dbSystemTime;
|
||||
CpuTime = CpuTime * 100.0 / (double)SystemBasicInfo.bKeNumberProcessors;// + 0.5;
|
||||
CpuTime = CpuTime * 100.0 / (double)SystemBasicInfo.bKeNumberProcessors; /* + 0.5; */
|
||||
pPerfData[Idx].CPUUsage = (ULONG)CpuTime;
|
||||
}
|
||||
pPerfData[Idx].CPUTime.QuadPart = pSPI->UserTime.QuadPart + pSPI->KernelTime.QuadPart;
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -40,7 +40,7 @@
|
|||
TGraphCtrl PerformancePageCpuUsageHistoryGraph;
|
||||
TGraphCtrl PerformancePageMemUsageHistoryGraph;
|
||||
|
||||
HWND hPerformancePage; // Performance Property Page
|
||||
HWND hPerformancePage; /* Performance Property Page */
|
||||
|
||||
HWND hPerformancePageCpuUsageGraph; // CPU Usage Graph
|
||||
HWND hPerformancePageMemUsageGraph; // MEM Usage Graph
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
/*
|
||||
* ReactOS Task Manager
|
||||
*
|
||||
* priority.cpp
|
||||
* priority.c
|
||||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
/*
|
||||
* ReactOS Task Manager
|
||||
*
|
||||
* proclist.cpp
|
||||
* proclist.c
|
||||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -53,70 +53,70 @@ LRESULT CALLBACK ProcessListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
{
|
||||
case WM_ERASEBKGND:
|
||||
|
||||
//
|
||||
// The list control produces a nasty flicker
|
||||
// when the user is resizing the window because
|
||||
// it erases the background to white, then
|
||||
// paints the list items over it.
|
||||
//
|
||||
// We will clip the drawing so that it only
|
||||
// erases the parts of the list control that
|
||||
// show only the background.
|
||||
//
|
||||
/*
|
||||
* The list control produces a nasty flicker
|
||||
* when the user is resizing the window because
|
||||
* it erases the background to white, then
|
||||
* paints the list items over it.
|
||||
*
|
||||
* We will clip the drawing so that it only
|
||||
* erases the parts of the list control that
|
||||
* show only the background.
|
||||
*/
|
||||
|
||||
//
|
||||
// Get the device context and save it's state
|
||||
// to be restored after we're done
|
||||
//
|
||||
/*
|
||||
* Get the device context and save it's state
|
||||
* to be restored after we're done
|
||||
*/
|
||||
hDC = (HDC) wParam;
|
||||
DcSave = SaveDC(hDC);
|
||||
|
||||
//
|
||||
// Get the background brush
|
||||
//
|
||||
/*
|
||||
* Get the background brush
|
||||
*/
|
||||
hbrBackground = (HBRUSH) GetClassLong(hWnd, GCL_HBRBACKGROUND);
|
||||
|
||||
//
|
||||
// Calculate the clip rect by getting the RECT
|
||||
// of the first and last items and adding them up.
|
||||
//
|
||||
// We also have to get the item's icon RECT and
|
||||
// subtract it from our clip rect because we don't
|
||||
// use icons in this list control.
|
||||
//
|
||||
/*
|
||||
* Calculate the clip rect by getting the RECT
|
||||
* of the first and last items and adding them up.
|
||||
*
|
||||
* We also have to get the item's icon RECT and
|
||||
* subtract it from our clip rect because we don't
|
||||
* use icons in this list control.
|
||||
*/
|
||||
ListView_GetItemRect(hWnd, 0, &rcClip, LVIR_BOUNDS);
|
||||
ListView_GetItemRect(hWnd, ListView_GetItemCount(hWnd) - 1, &rcItem, LVIR_BOUNDS);
|
||||
rcClip.bottom = rcItem.bottom;
|
||||
ListView_GetItemRect(hWnd, 0, &rcItem, LVIR_ICON);
|
||||
rcClip.left = rcItem.right;
|
||||
|
||||
//
|
||||
// Now exclude the clip rect
|
||||
//
|
||||
/*
|
||||
* Now exclude the clip rect
|
||||
*/
|
||||
ExcludeClipRect(hDC, rcClip.left, rcClip.top, rcClip.right, rcClip.bottom);
|
||||
|
||||
//
|
||||
// Now erase the background
|
||||
//
|
||||
//
|
||||
// FIXME: Should I erase it myself or
|
||||
// pass down the updated HDC and let
|
||||
// the default handler do it?
|
||||
//
|
||||
/*
|
||||
* Now erase the background
|
||||
*
|
||||
*
|
||||
* FIXME: Should I erase it myself or
|
||||
* pass down the updated HDC and let
|
||||
* the default handler do it?
|
||||
*/
|
||||
GetClientRect(hWnd, &rcItem);
|
||||
FillRect(hDC, &rcItem, hbrBackground);
|
||||
|
||||
//
|
||||
// Now restore the DC state that we
|
||||
// saved earlier
|
||||
//
|
||||
/*
|
||||
* Now restore the DC state that we
|
||||
* saved earlier
|
||||
*/
|
||||
RestoreDC(hDC, DcSave);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// We pass on all messages except WM_ERASEBKGND
|
||||
//
|
||||
/*
|
||||
* We pass on all messages except WM_ERASEBKGND
|
||||
*/
|
||||
return CallWindowProc((WNDPROC)OldProcessListWndProc, hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
/*
|
||||
* ReactOS Task Manager
|
||||
*
|
||||
* processpage.cpp
|
||||
* procpage.c
|
||||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -37,17 +37,17 @@
|
|||
#include "proclist.h"
|
||||
#include <ctype.h>
|
||||
|
||||
HWND hProcessPage; // Process List Property Page
|
||||
HWND hProcessPage; /* Process List Property Page */
|
||||
|
||||
HWND hProcessPageListCtrl; // Process ListCtrl Window
|
||||
HWND hProcessPageHeaderCtrl; // Process Header Control
|
||||
HWND hProcessPageEndProcessButton; // Process End Process button
|
||||
HWND hProcessPageShowAllProcessesButton;// Process Show All Processes checkbox
|
||||
HWND hProcessPageListCtrl; /* Process ListCtrl Window */
|
||||
HWND hProcessPageHeaderCtrl; /* Process Header Control */
|
||||
HWND hProcessPageEndProcessButton; /* Process End Process button */
|
||||
HWND hProcessPageShowAllProcessesButton;/* Process Show All Processes checkbox */
|
||||
|
||||
static int nProcessPageWidth;
|
||||
static int nProcessPageHeight;
|
||||
|
||||
static HANDLE hProcessPageEvent = NULL; // When this event becomes signaled then we refresh the process list
|
||||
static HANDLE hProcessPageEvent = NULL; /* When this event becomes signaled then we refresh the process list */
|
||||
|
||||
void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam);
|
||||
void CommaSeparateNumberString(LPTSTR strNumber, int nMaxCount);
|
||||
|
@ -63,46 +63,46 @@ LRESULT CALLBACK ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
|
|||
|
||||
switch (message) {
|
||||
case WM_INITDIALOG:
|
||||
//
|
||||
// Save the width and height
|
||||
//
|
||||
/*
|
||||
* Save the width and height
|
||||
*/
|
||||
GetClientRect(hDlg, &rc);
|
||||
nProcessPageWidth = rc.right;
|
||||
nProcessPageHeight = rc.bottom;
|
||||
|
||||
// Update window position
|
||||
/* Update window position */
|
||||
SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
|
||||
|
||||
//
|
||||
// Get handles to the controls
|
||||
//
|
||||
/*
|
||||
* Get handles to the controls
|
||||
*/
|
||||
hProcessPageListCtrl = GetDlgItem(hDlg, IDC_PROCESSLIST);
|
||||
hProcessPageHeaderCtrl = ListView_GetHeader(hProcessPageListCtrl);
|
||||
hProcessPageEndProcessButton = GetDlgItem(hDlg, IDC_ENDPROCESS);
|
||||
hProcessPageShowAllProcessesButton = GetDlgItem(hDlg, IDC_SHOWALLPROCESSES);
|
||||
|
||||
//
|
||||
// Set the font, title, and extended window styles for the list control
|
||||
//
|
||||
/*
|
||||
* Set the font, title, and extended window styles for the list control
|
||||
*/
|
||||
SendMessage(hProcessPageListCtrl, WM_SETFONT, SendMessage(hProcessPage, WM_GETFONT, 0, 0), TRUE);
|
||||
SetWindowText(hProcessPageListCtrl, _T("Processes"));
|
||||
ListView_SetExtendedListViewStyle(hProcessPageListCtrl, ListView_GetExtendedListViewStyle(hProcessPageListCtrl) | LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);
|
||||
|
||||
AddColumns();
|
||||
|
||||
//
|
||||
// Subclass the process list control so we can intercept WM_ERASEBKGND
|
||||
//
|
||||
/*
|
||||
* Subclass the process list control so we can intercept WM_ERASEBKGND
|
||||
*/
|
||||
OldProcessListWndProc = SetWindowLong(hProcessPageListCtrl, GWL_WNDPROC, (LONG)ProcessListWndProc);
|
||||
|
||||
// Start our refresh thread
|
||||
/* Start our refresh thread */
|
||||
_beginthread(ProcessPageRefreshThread, 0, NULL);
|
||||
|
||||
return TRUE;
|
||||
|
||||
case WM_DESTROY:
|
||||
// Close the event handle, this will make the
|
||||
// refresh thread exit when the wait fails
|
||||
/* Close the event handle, this will make the */
|
||||
/* refresh thread exit when the wait fails */
|
||||
CloseHandle(hProcessPageEvent);
|
||||
|
||||
SaveColumnSettings();
|
||||
|
@ -123,7 +123,7 @@ LRESULT CALLBACK ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
|
|||
nProcessPageWidth = cx;
|
||||
nProcessPageHeight = cy;
|
||||
|
||||
// Reposition the application page's controls
|
||||
/* Reposition the application page's controls */
|
||||
GetWindowRect(hProcessPageListCtrl, &rc);
|
||||
cx = (rc.right - rc.left) + nXDifference;
|
||||
cy = (rc.bottom - rc.top) + nYDifference;
|
||||
|
@ -178,9 +178,11 @@ void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
switch (pnmh->code)
|
||||
{
|
||||
/*case LVN_ITEMCHANGED:
|
||||
#if 0
|
||||
case LVN_ITEMCHANGED:
|
||||
ProcessPageUpdate();
|
||||
break;*/
|
||||
break;
|
||||
#endif
|
||||
|
||||
case LVN_GETDISPINFO:
|
||||
|
||||
|
@ -367,11 +369,12 @@ void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
case HDN_ITEMCLICK:
|
||||
|
||||
//
|
||||
// FIXME: Fix the column sorting
|
||||
//
|
||||
//ListView_SortItems(hApplicationPageListCtrl, ApplicationPageCompareFunc, NULL);
|
||||
//bSortAscending = !bSortAscending;
|
||||
/*
|
||||
* FIXME: Fix the column sorting
|
||||
*
|
||||
*ListView_SortItems(hApplicationPageListCtrl, ApplicationPageCompareFunc, NULL);
|
||||
*bSortAscending = !bSortAscending;
|
||||
*/
|
||||
|
||||
break;
|
||||
|
||||
|
@ -483,8 +486,8 @@ void ProcessPageShowContextMenu(DWORD dwProcessId)
|
|||
|
||||
void RefreshProcessPage(void)
|
||||
{
|
||||
// Signal the event so that our refresh thread
|
||||
// will wake up and refresh the process page
|
||||
/* Signal the event so that our refresh thread */
|
||||
/* will wake up and refresh the process page */
|
||||
SetEvent(hProcessPageEvent);
|
||||
}
|
||||
|
||||
|
@ -493,28 +496,28 @@ void ProcessPageRefreshThread(void *lpParameter)
|
|||
ULONG OldProcessorUsage = 0;
|
||||
ULONG OldProcessCount = 0;
|
||||
|
||||
// Create the event
|
||||
/* Create the event */
|
||||
hProcessPageEvent = CreateEvent(NULL, TRUE, TRUE, _T("Process Page Event"));
|
||||
|
||||
// If we couldn't create the event then exit the thread
|
||||
/* If we couldn't create the event then exit the thread */
|
||||
if (!hProcessPageEvent)
|
||||
return;
|
||||
|
||||
while (1) {
|
||||
DWORD dwWaitVal;
|
||||
|
||||
// Wait on the event
|
||||
/* Wait on the event */
|
||||
dwWaitVal = WaitForSingleObject(hProcessPageEvent, INFINITE);
|
||||
|
||||
// If the wait failed then the event object must have been
|
||||
// closed and the task manager is exiting so exit this thread
|
||||
/* If the wait failed then the event object must have been */
|
||||
/* closed and the task manager is exiting so exit this thread */
|
||||
if (dwWaitVal == WAIT_FAILED)
|
||||
return;
|
||||
|
||||
if (dwWaitVal == WAIT_OBJECT_0) {
|
||||
TCHAR text[260];
|
||||
|
||||
// Reset our event
|
||||
/* Reset our event */
|
||||
ResetEvent(hProcessPageEvent);
|
||||
|
||||
if ((ULONG)SendMessage(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0) != PerfDataGetProcessCount())
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
/*
|
||||
* ReactOS Task Manager
|
||||
*
|
||||
* run.cpp
|
||||
* run.c
|
||||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -46,7 +46,7 @@ void TaskManager_OnFileNew(void)
|
|||
hShell32 = LoadLibrary(_T("SHELL32.DLL"));
|
||||
RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (char*)((long)0x3D));
|
||||
|
||||
// Show "Run..." dialog
|
||||
/* Show "Run..." dialog */
|
||||
if (RunFileDlg)
|
||||
{
|
||||
versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
|
|
|
@ -18,13 +18,12 @@
|
|||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* run.h - definitions necessary to use Microsoft's "Run" dialog
|
||||
*
|
||||
* run.h - definitions necessary to use Microsoft's "Run" dialog
|
||||
* Undocumented Windows call
|
||||
* use the type below to declare a function pointer
|
||||
*
|
||||
* Information taken from http:/*www.geocities.com/SiliconValley/4942/
|
||||
* Information taken from http://www.geocities.com/SiliconValley/4942/
|
||||
* Copyright © 1998-1999 James Holderness. All Rights Reserved.
|
||||
* jholderness@geocities.com
|
||||
*/
|
||||
|
@ -35,12 +34,12 @@
|
|||
void TaskManager_OnFileNew(void);
|
||||
|
||||
typedef void (WINAPI *RUNFILEDLG)(
|
||||
HWND hwndOwner,
|
||||
HICON hIcon,
|
||||
LPCSTR lpstrDirectory,
|
||||
LPCSTR lpstrTitle,
|
||||
LPCSTR lpstrDescription,
|
||||
UINT uFlags);
|
||||
HWND hwndOwner,
|
||||
HICON hIcon,
|
||||
LPCSTR lpstrDirectory,
|
||||
LPCSTR lpstrTitle,
|
||||
LPCSTR lpstrDescription,
|
||||
UINT uFlags);
|
||||
|
||||
/*
|
||||
* Flags for RunFileDlg
|
||||
|
|
|
@ -1,7 +1,26 @@
|
|||
// TaskMgr.cpp : Defines the entry point for the application.
|
||||
//
|
||||
/*
|
||||
* ReactOS Task Manager
|
||||
*
|
||||
* TaskMgr.c : Defines the entry point for the application.
|
||||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -29,20 +48,20 @@
|
|||
|
||||
#define STATUS_WINDOW 2001
|
||||
|
||||
// Global Variables:
|
||||
HINSTANCE hInst; // current instance
|
||||
/* Global Variables: */
|
||||
HINSTANCE hInst; /* current instance */
|
||||
|
||||
HWND hMainWnd; // Main Window
|
||||
HWND hStatusWnd; // Status Bar Window
|
||||
HWND hTabWnd; // Tab Control Window
|
||||
HWND hMainWnd; /* Main Window */
|
||||
HWND hStatusWnd; /* Status Bar Window */
|
||||
HWND hTabWnd; /* Tab Control Window */
|
||||
|
||||
int nMinimumWidth; // Minimum width of the dialog (OnSize()'s cx)
|
||||
int nMinimumHeight; // Minimum height of the dialog (OnSize()'s cy)
|
||||
int nMinimumWidth; /* Minimum width of the dialog (OnSize()'s cx) */
|
||||
int nMinimumHeight; /* Minimum height of the dialog (OnSize()'s cy) */
|
||||
|
||||
int nOldWidth; // Holds the previous client area width
|
||||
int nOldHeight; // Holds the previous client area height
|
||||
int nOldWidth; /* Holds the previous client area width */
|
||||
int nOldHeight; /* Holds the previous client area height */
|
||||
|
||||
BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop
|
||||
BOOL bInMenuLoop = FALSE; /* Tells us if we are in the menu loop */
|
||||
|
||||
TASKMANAGER_SETTINGS TaskManagerSettings;
|
||||
|
||||
|
@ -56,56 +75,47 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
HANDLE hToken;
|
||||
TOKEN_PRIVILEGES tkp;
|
||||
|
||||
// Initialize global variables
|
||||
/* Initialize global variables */
|
||||
hInst = hInstance;
|
||||
|
||||
// Change our priority class to HIGH
|
||||
/* Change our priority class to HIGH */
|
||||
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId());
|
||||
SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS);
|
||||
CloseHandle(hProcess);
|
||||
|
||||
// Now lets get the SE_DEBUG_NAME priviledge
|
||||
// so that we can debug processes
|
||||
/* Now lets get the SE_DEBUG_NAME priviledge
|
||||
* so that we can debug processes
|
||||
*/
|
||||
|
||||
// Get a token for this process.
|
||||
/* Get a token for this process. */
|
||||
if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) {
|
||||
// Get the LUID for the debug privilege.
|
||||
/* Get the LUID for the debug privilege. */
|
||||
LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &tkp.Privileges[0].Luid);
|
||||
|
||||
tkp.PrivilegeCount = 1; // one privilege to set
|
||||
tkp.PrivilegeCount = 1; /* one privilege to set */
|
||||
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
|
||||
|
||||
// Get the debug privilege for this process.
|
||||
/* Get the debug privilege for this process. */
|
||||
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
|
||||
}
|
||||
|
||||
// Load our settings from the registry
|
||||
/* Load our settings from the registry */
|
||||
LoadSettings();
|
||||
|
||||
// Initialize perf data
|
||||
/* Initialize perf data */
|
||||
if (!PerfDataInitialize()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
DialogBox(hInst, (LPCTSTR)IDD_TASKMGR_DIALOG, NULL, (DLGPROC)TaskManagerWndProc);
|
||||
|
||||
// Save our settings to the registry
|
||||
/* Save our settings to the registry */
|
||||
SaveSettings();
|
||||
PerfDataUninitialize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define _USE_CMD_MAP
|
||||
|
||||
#ifdef _USE_CMD_MAP
|
||||
//#define BEGIN_CMD_MAP(a) switch( ##a ) {
|
||||
#define BEGIN_CMD_MAP(a) switch( a ) {
|
||||
#define CMD_MAP_ENTRY(a, b) case a: b(); break;
|
||||
#define END_CMD_MAP(a) }
|
||||
|
||||
#endif
|
||||
|
||||
// Message handler for dialog box.
|
||||
/* Message handler for dialog box. */
|
||||
LRESULT CALLBACK TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HDC hdc;
|
||||
|
@ -126,48 +136,7 @@ LRESULT CALLBACK TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
|
|||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return TRUE;
|
||||
}
|
||||
#ifdef _USE_CMD_MAP
|
||||
BEGIN_CMD_MAP( LOWORD(wParam) )
|
||||
CMD_MAP_ENTRY(ID_FILE_NEW, TaskManager_OnFileNew)
|
||||
CMD_MAP_ENTRY(ID_OPTIONS_ALWAYSONTOP, TaskManager_OnOptionsAlwaysOnTop)
|
||||
CMD_MAP_ENTRY(ID_OPTIONS_MINIMIZEONUSE, TaskManager_OnOptionsMinimizeOnUse)
|
||||
CMD_MAP_ENTRY(ID_OPTIONS_HIDEWHENMINIMIZED, TaskManager_OnOptionsHideWhenMinimized)
|
||||
CMD_MAP_ENTRY(ID_OPTIONS_SHOW16BITTASKS, TaskManager_OnOptionsShow16BitTasks)
|
||||
CMD_MAP_ENTRY(ID_VIEW_LARGE, ApplicationPage_OnViewLargeIcons)
|
||||
CMD_MAP_ENTRY(ID_VIEW_SMALL, ApplicationPage_OnViewSmallIcons)
|
||||
CMD_MAP_ENTRY(ID_VIEW_DETAILS, ApplicationPage_OnViewDetails)
|
||||
CMD_MAP_ENTRY(ID_VIEW_SHOWKERNELTIMES, PerformancePage_OnViewShowKernelTimes)
|
||||
CMD_MAP_ENTRY(ID_VIEW_CPUHISTORY_ONEGRAPHALL, PerformancePage_OnViewCPUHistoryOneGraphAll)
|
||||
CMD_MAP_ENTRY(ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, PerformancePage_OnViewCPUHistoryOneGraphPerCPU)
|
||||
CMD_MAP_ENTRY(ID_VIEW_UPDATESPEED_HIGH, TaskManager_OnViewUpdateSpeedHigh)
|
||||
CMD_MAP_ENTRY(ID_VIEW_UPDATESPEED_NORMAL, TaskManager_OnViewUpdateSpeedNormal)
|
||||
CMD_MAP_ENTRY(ID_VIEW_UPDATESPEED_LOW, TaskManager_OnViewUpdateSpeedLow)
|
||||
CMD_MAP_ENTRY(ID_VIEW_UPDATESPEED_PAUSED, TaskManager_OnViewUpdateSpeedPaused)
|
||||
CMD_MAP_ENTRY(ID_VIEW_SELECTCOLUMNS, ProcessPage_OnViewSelectColumns)
|
||||
CMD_MAP_ENTRY(ID_VIEW_REFRESH, TaskManager_OnViewRefresh)
|
||||
CMD_MAP_ENTRY(ID_WINDOWS_TILEHORIZONTALLY, ApplicationPage_OnWindowsTileHorizontally)
|
||||
CMD_MAP_ENTRY(ID_WINDOWS_TILEVERTICALLY, ApplicationPage_OnWindowsTileVertically)
|
||||
CMD_MAP_ENTRY(ID_WINDOWS_MINIMIZE, ApplicationPage_OnWindowsMinimize)
|
||||
CMD_MAP_ENTRY(ID_WINDOWS_MAXIMIZE, ApplicationPage_OnWindowsMaximize)
|
||||
CMD_MAP_ENTRY(ID_WINDOWS_CASCADE, ApplicationPage_OnWindowsCascade)
|
||||
CMD_MAP_ENTRY(ID_WINDOWS_BRINGTOFRONT, ApplicationPage_OnWindowsBringToFront)
|
||||
CMD_MAP_ENTRY(ID_APPLICATION_PAGE_SWITCHTO, ApplicationPage_OnSwitchTo)
|
||||
CMD_MAP_ENTRY(ID_APPLICATION_PAGE_ENDTASK, ApplicationPage_OnEndTask)
|
||||
CMD_MAP_ENTRY(ID_APPLICATION_PAGE_GOTOPROCESS, ApplicationPage_OnGotoProcess)
|
||||
CMD_MAP_ENTRY(ID_PROCESS_PAGE_ENDPROCESS, ProcessPage_OnEndProcess)
|
||||
CMD_MAP_ENTRY(ID_PROCESS_PAGE_ENDPROCESSTREE, ProcessPage_OnEndProcessTree)
|
||||
CMD_MAP_ENTRY(ID_PROCESS_PAGE_DEBUG, ProcessPage_OnDebug)
|
||||
CMD_MAP_ENTRY(ID_PROCESS_PAGE_SETAFFINITY, ProcessPage_OnSetAffinity)
|
||||
CMD_MAP_ENTRY(ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ProcessPage_OnSetPriorityRealTime)
|
||||
CMD_MAP_ENTRY(ID_PROCESS_PAGE_SETPRIORITY_HIGH, ProcessPage_OnSetPriorityHigh)
|
||||
CMD_MAP_ENTRY(ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL, ProcessPage_OnSetPriorityAboveNormal)
|
||||
CMD_MAP_ENTRY(ID_PROCESS_PAGE_SETPRIORITY_NORMAL, ProcessPage_OnSetPriorityNormal)
|
||||
CMD_MAP_ENTRY(ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL, ProcessPage_OnSetPriorityBelowNormal)
|
||||
CMD_MAP_ENTRY(ID_PROCESS_PAGE_SETPRIORITY_LOW, ProcessPage_OnSetPriorityLow)
|
||||
CMD_MAP_ENTRY(ID_HELP_ABOUT, OnAbout)
|
||||
END_CMD_MAP(0)
|
||||
#else
|
||||
// Process menu commands
|
||||
/* Process menu commands */
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case ID_FILE_NEW:
|
||||
|
@ -281,8 +250,10 @@ LRESULT CALLBACK TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
|
|||
case ID_HELP_ABOUT:
|
||||
OnAbout();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case ID_FILE_EXIT:
|
||||
DestroyWindow(hDlg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
|
@ -311,24 +282,24 @@ LRESULT CALLBACK TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
|
|||
break;
|
||||
|
||||
case WM_SIZING:
|
||||
// Make sure the user is sizing the dialog
|
||||
// in an acceptable range
|
||||
/* Make sure the user is sizing the dialog */
|
||||
/* in an acceptable range */
|
||||
pRC = (LPRECT)lParam;
|
||||
if ((wParam == WMSZ_LEFT) || (wParam == WMSZ_TOPLEFT) || (wParam == WMSZ_BOTTOMLEFT)) {
|
||||
// If the width is too small enlarge it to the minimum
|
||||
/* If the width is too small enlarge it to the minimum */
|
||||
if (nMinimumWidth > (pRC->right - pRC->left))
|
||||
pRC->left = pRC->right - nMinimumWidth;
|
||||
} else {
|
||||
// If the width is too small enlarge it to the minimum
|
||||
/* If the width is too small enlarge it to the minimum */
|
||||
if (nMinimumWidth > (pRC->right - pRC->left))
|
||||
pRC->right = pRC->left + nMinimumWidth;
|
||||
}
|
||||
if ((wParam == WMSZ_TOP) || (wParam == WMSZ_TOPLEFT) || (wParam == WMSZ_TOPRIGHT)) {
|
||||
// If the height is too small enlarge it to the minimum
|
||||
/* If the height is too small enlarge it to the minimum */
|
||||
if (nMinimumHeight > (pRC->bottom - pRC->top))
|
||||
pRC->top = pRC->bottom - nMinimumHeight;
|
||||
} else {
|
||||
// If the height is too small enlarge it to the minimum
|
||||
/* If the height is too small enlarge it to the minimum */
|
||||
if (nMinimumHeight > (pRC->bottom - pRC->top))
|
||||
pRC->bottom = pRC->top + nMinimumHeight;
|
||||
}
|
||||
|
@ -336,12 +307,12 @@ LRESULT CALLBACK TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
|
|||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
// Handle the window sizing in it's own function
|
||||
/* Handle the window sizing in it's own function */
|
||||
OnSize(wParam, LOWORD(lParam), HIWORD(lParam));
|
||||
break;
|
||||
|
||||
case WM_MOVE:
|
||||
// Handle the window moving in it's own function
|
||||
/* Handle the window moving in it's own function */
|
||||
OnMove(wParam, LOWORD(lParam), HIWORD(lParam));
|
||||
break;
|
||||
|
||||
|
@ -361,7 +332,7 @@ LRESULT CALLBACK TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
|
|||
return DefWindowProc(hDlg, message, wParam, lParam);
|
||||
|
||||
case WM_TIMER:
|
||||
// Refresh the performance data
|
||||
/* Refresh the performance data */
|
||||
PerfDataRefresh();
|
||||
RefreshApplicationPage();
|
||||
RefreshProcessPage();
|
||||
|
@ -430,26 +401,26 @@ BOOL OnCreate(HWND hWnd)
|
|||
|
||||
SendMessage(hMainWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_TASKMANAGER)));
|
||||
|
||||
// Initialize the Windows Common Controls DLL
|
||||
/* Initialize the Windows Common Controls DLL */
|
||||
InitCommonControls();
|
||||
|
||||
// Get the minimum window sizes
|
||||
/* Get the minimum window sizes */
|
||||
GetWindowRect(hWnd, &rc);
|
||||
nMinimumWidth = (rc.right - rc.left);
|
||||
nMinimumHeight = (rc.bottom - rc.top);
|
||||
|
||||
// Create the status bar
|
||||
/* Create the status bar */
|
||||
hStatusWnd = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS, _T(""), hWnd, STATUS_WINDOW);
|
||||
if(!hStatusWnd)
|
||||
return FALSE;
|
||||
|
||||
// Create the status bar panes
|
||||
/* Create the status bar panes */
|
||||
nParts[0] = 100;
|
||||
nParts[1] = 210;
|
||||
nParts[2] = 400;
|
||||
SendMessage(hStatusWnd, SB_SETPARTS, 3, (long)nParts);
|
||||
|
||||
// Create tab pages
|
||||
/* Create tab pages */
|
||||
hTabWnd = GetDlgItem(hWnd, IDC_TAB);
|
||||
#if 1
|
||||
hApplicationPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_APPLICATION_PAGE), hWnd, (DLGPROC)ApplicationPageWndProc);
|
||||
|
@ -460,7 +431,7 @@ BOOL OnCreate(HWND hWnd)
|
|||
hProcessPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_PROCESS_PAGE), hTabWnd, (DLGPROC)ProcessPageWndProc);
|
||||
hPerformancePage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_PERFORMANCE_PAGE), hTabWnd, (DLGPROC)PerformancePageWndProc);
|
||||
#endif
|
||||
// Insert tabs
|
||||
/* Insert tabs */
|
||||
_tcscpy(szTemp, _T("Applications"));
|
||||
memset(&item, 0, sizeof(TCITEM));
|
||||
item.mask = TCIF_TEXT;
|
||||
|
@ -477,12 +448,12 @@ BOOL OnCreate(HWND hWnd)
|
|||
item.pszText = szTemp;
|
||||
TabCtrl_InsertItem(hTabWnd, 2, &item);
|
||||
|
||||
// Size everything correctly
|
||||
/* Size everything correctly */
|
||||
GetClientRect(hWnd, &rc);
|
||||
nOldWidth = rc.right;
|
||||
nOldHeight = rc.bottom;
|
||||
//nOldStartX = rc.left;
|
||||
//nOldStartY = rc.top;
|
||||
/* nOldStartX = rc.left; */
|
||||
/*nOldStartY = rc.top; */
|
||||
|
||||
#define PAGE_OFFSET_LEFT 17
|
||||
#define PAGE_OFFSET_TOP 72
|
||||
|
@ -504,14 +475,14 @@ BOOL OnCreate(HWND hWnd)
|
|||
if (TaskManagerSettings.Maximized)
|
||||
ShowWindow(hWnd, SW_MAXIMIZE);
|
||||
|
||||
// Set the always on top style
|
||||
/* Set the always on top style */
|
||||
hMenu = GetMenu(hWnd);
|
||||
hEditMenu = GetSubMenu(hMenu, 1);
|
||||
hViewMenu = GetSubMenu(hMenu, 2);
|
||||
hUpdateSpeedMenu = GetSubMenu(hViewMenu, 1);
|
||||
hCPUHistoryMenu = GetSubMenu(hViewMenu, 7);
|
||||
|
||||
// Check or uncheck the always on top menu item
|
||||
/* Check or uncheck the always on top menu item */
|
||||
if (TaskManagerSettings.AlwaysOnTop) {
|
||||
CheckMenuItem(hEditMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND|MF_CHECKED);
|
||||
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
|
||||
|
@ -520,19 +491,19 @@ BOOL OnCreate(HWND hWnd)
|
|||
SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
|
||||
}
|
||||
|
||||
// Check or uncheck the minimize on use menu item
|
||||
/* Check or uncheck the minimize on use menu item */
|
||||
if (TaskManagerSettings.MinimizeOnUse)
|
||||
CheckMenuItem(hEditMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_CHECKED);
|
||||
else
|
||||
CheckMenuItem(hEditMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_UNCHECKED);
|
||||
|
||||
// Check or uncheck the hide when minimized menu item
|
||||
/* Check or uncheck the hide when minimized menu item */
|
||||
if (TaskManagerSettings.HideWhenMinimized)
|
||||
CheckMenuItem(hEditMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_CHECKED);
|
||||
else
|
||||
CheckMenuItem(hEditMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_UNCHECKED);
|
||||
|
||||
// Check or uncheck the show 16-bit tasks menu item
|
||||
/* Check or uncheck the show 16-bit tasks menu item */
|
||||
if (TaskManagerSettings.Show16BitTasks)
|
||||
CheckMenuItem(hEditMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_CHECKED);
|
||||
else
|
||||
|
@ -588,11 +559,11 @@ BOOL OnCreate(HWND hWnd)
|
|||
SetTimer(hWnd, 1, 4000, NULL);
|
||||
}
|
||||
|
||||
//
|
||||
// Refresh the performance data
|
||||
// Sample it twice so we can establish
|
||||
// the delta values & cpu usage
|
||||
//
|
||||
/*
|
||||
* Refresh the performance data
|
||||
* Sample it twice so we can establish
|
||||
* the delta values & cpu usage
|
||||
*/
|
||||
PerfDataRefresh();
|
||||
PerfDataRefresh();
|
||||
|
||||
|
@ -605,9 +576,10 @@ BOOL OnCreate(HWND hWnd)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
// OnMove()
|
||||
// This function handles all the moving events for the application
|
||||
// It moves every child window that needs moving
|
||||
/* OnMove()
|
||||
* This function handles all the moving events for the application
|
||||
* It moves every child window that needs moving
|
||||
*/
|
||||
void OnMove( UINT nType, int cx, int cy )
|
||||
{
|
||||
#ifdef __GNUC__TEST__
|
||||
|
@ -617,9 +589,10 @@ void OnMove( UINT nType, int cx, int cy )
|
|||
#endif
|
||||
}
|
||||
|
||||
// OnSize()
|
||||
// This function handles all the sizing events for the application
|
||||
// It re-sizes every window, and child window that needs re-sizing
|
||||
/* OnSize()
|
||||
* This function handles all the sizing events for the application
|
||||
* It re-sizes every window, and child window that needs re-sizing
|
||||
*/
|
||||
void OnSize( UINT nType, int cx, int cy )
|
||||
{
|
||||
int nParts[3];
|
||||
|
@ -635,35 +608,35 @@ void OnSize( UINT nType, int cx, int cy )
|
|||
nOldWidth = cx;
|
||||
nOldHeight = cy;
|
||||
|
||||
// Update the status bar size
|
||||
/* Update the status bar size */
|
||||
GetWindowRect(hStatusWnd, &rc);
|
||||
SendMessage(hStatusWnd, WM_SIZE, nType, MAKELPARAM(cx, cy + (rc.bottom - rc.top)));
|
||||
|
||||
// Update the status bar pane sizes
|
||||
/* Update the status bar pane sizes */
|
||||
nParts[0] = bInMenuLoop ? -1 : 100;
|
||||
nParts[1] = 210;
|
||||
nParts[2] = cx;
|
||||
SendMessage(hStatusWnd, SB_SETPARTS, bInMenuLoop ? 1 : 3, (long)nParts);
|
||||
|
||||
// Resize the tab control
|
||||
/* Resize the tab control */
|
||||
GetWindowRect(hTabWnd, &rc);
|
||||
cx = (rc.right - rc.left) + nXDifference;
|
||||
cy = (rc.bottom - rc.top) + nYDifference;
|
||||
SetWindowPos(hTabWnd, NULL, 0, 0, cx, cy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOMOVE|SWP_NOZORDER);
|
||||
|
||||
// Resize the application page
|
||||
/* Resize the application page */
|
||||
GetWindowRect(hApplicationPage, &rc);
|
||||
cx = (rc.right - rc.left) + nXDifference;
|
||||
cy = (rc.bottom - rc.top) + nYDifference;
|
||||
SetWindowPos(hApplicationPage, NULL, 0, 0, cx, cy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOMOVE|SWP_NOZORDER);
|
||||
|
||||
// Resize the process page
|
||||
/* Resize the process page */
|
||||
GetWindowRect(hProcessPage, &rc);
|
||||
cx = (rc.right - rc.left) + nXDifference;
|
||||
cy = (rc.bottom - rc.top) + nYDifference;
|
||||
SetWindowPos(hProcessPage, NULL, 0, 0, cx, cy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOMOVE|SWP_NOZORDER);
|
||||
|
||||
// Resize the performance page
|
||||
/* Resize the performance page */
|
||||
GetWindowRect(hPerformancePage, &rc);
|
||||
cx = (rc.right - rc.left) + nXDifference;
|
||||
cy = (rc.bottom - rc.top) + nYDifference;
|
||||
|
@ -678,32 +651,32 @@ void LoadSettings(void)
|
|||
int i;
|
||||
DWORD dwSize;
|
||||
|
||||
// Window size & position settings
|
||||
/* Window size & position settings */
|
||||
TaskManagerSettings.Maximized = FALSE;
|
||||
TaskManagerSettings.Left = 0;
|
||||
TaskManagerSettings.Top = 0;
|
||||
TaskManagerSettings.Right = 0;
|
||||
TaskManagerSettings.Bottom = 0;
|
||||
|
||||
// Tab settings
|
||||
/* Tab settings */
|
||||
TaskManagerSettings.ActiveTabPage = 0;
|
||||
|
||||
// Options menu settings
|
||||
/* Options menu settings */
|
||||
TaskManagerSettings.AlwaysOnTop = FALSE;
|
||||
TaskManagerSettings.MinimizeOnUse = TRUE;
|
||||
TaskManagerSettings.HideWhenMinimized = TRUE;
|
||||
TaskManagerSettings.Show16BitTasks = TRUE;
|
||||
|
||||
// Update speed settings
|
||||
/* Update speed settings */
|
||||
TaskManagerSettings.UpdateSpeed = 2;
|
||||
|
||||
// Applications page settings
|
||||
/* Applications page settings */
|
||||
TaskManagerSettings.View_LargeIcons = FALSE;
|
||||
TaskManagerSettings.View_SmallIcons = FALSE;
|
||||
TaskManagerSettings.View_Details = TRUE;
|
||||
|
||||
// Processes page settings
|
||||
TaskManagerSettings.ShowProcessesFromAllUsers = FALSE; // Server-only?
|
||||
/* Processes page settings */
|
||||
TaskManagerSettings.ShowProcessesFromAllUsers = FALSE; /* Server-only? */
|
||||
TaskManagerSettings.Column_ImageName = TRUE;
|
||||
TaskManagerSettings.Column_PID = TRUE;
|
||||
TaskManagerSettings.Column_CPUUsage = TRUE;
|
||||
|
@ -715,8 +688,8 @@ void LoadSettings(void)
|
|||
TaskManagerSettings.Column_USERObjects = FALSE;
|
||||
TaskManagerSettings.Column_IOReads = FALSE;
|
||||
TaskManagerSettings.Column_IOReadBytes = FALSE;
|
||||
TaskManagerSettings.Column_SessionID = FALSE; // Server-only?
|
||||
TaskManagerSettings.Column_UserName = FALSE; // Server-only?
|
||||
TaskManagerSettings.Column_SessionID = FALSE; /* Server-only? */
|
||||
TaskManagerSettings.Column_UserName = FALSE; /* Server-only? */
|
||||
TaskManagerSettings.Column_PageFaultsDelta = FALSE;
|
||||
TaskManagerSettings.Column_VirtualMemorySize = FALSE;
|
||||
TaskManagerSettings.Column_PagedPool = FALSE;
|
||||
|
@ -762,18 +735,18 @@ void LoadSettings(void)
|
|||
TaskManagerSettings.SortColumn = 1;
|
||||
TaskManagerSettings.SortAscending = TRUE;
|
||||
|
||||
// Performance page settings
|
||||
/* Performance page settings */
|
||||
TaskManagerSettings.CPUHistory_OneGraphPerCPU = TRUE;
|
||||
TaskManagerSettings.ShowKernelTimes = FALSE;
|
||||
|
||||
// Open the key
|
||||
/* Open the key */
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, szSubKey, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
|
||||
return;
|
||||
// Read the settings
|
||||
/* Read the settings */
|
||||
dwSize = sizeof(TASKMANAGER_SETTINGS);
|
||||
RegQueryValueEx(hKey, _T("Preferences"), NULL, NULL, (LPBYTE)&TaskManagerSettings, &dwSize);
|
||||
|
||||
// Close the key
|
||||
/* Close the key */
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
|
@ -784,7 +757,7 @@ void SaveSettings(void)
|
|||
TCHAR szSubKey2[] = _T("Software\\ReactWare");
|
||||
TCHAR szSubKey3[] = _T("Software\\ReactWare\\TaskManager");
|
||||
|
||||
// Open (or create) the key
|
||||
/* Open (or create) the key */
|
||||
hKey = NULL;
|
||||
RegCreateKeyEx(HKEY_CURRENT_USER, szSubKey1, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL);
|
||||
RegCloseKey(hKey);
|
||||
|
@ -794,9 +767,9 @@ void SaveSettings(void)
|
|||
hKey = NULL;
|
||||
if (RegCreateKeyEx(HKEY_CURRENT_USER, szSubKey3, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) != ERROR_SUCCESS)
|
||||
return;
|
||||
// Save the settings
|
||||
/* Save the settings */
|
||||
RegSetValueEx(hKey, _T("Preferences"), 0, REG_BINARY, (LPBYTE)&TaskManagerSettings, sizeof(TASKMANAGER_SETTINGS));
|
||||
// Close the key
|
||||
/* Close the key */
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
|
@ -804,7 +777,7 @@ void TaskManager_OnEnterMenuLoop(HWND hWnd)
|
|||
{
|
||||
int nParts;
|
||||
|
||||
// Update the status bar pane sizes
|
||||
/* Update the status bar pane sizes */
|
||||
nParts = -1;
|
||||
SendMessage(hStatusWnd, SB_SETPARTS, 1, (long)&nParts);
|
||||
bInMenuLoop = TRUE;
|
||||
|
@ -818,7 +791,7 @@ void TaskManager_OnExitMenuLoop(HWND hWnd)
|
|||
TCHAR text[260];
|
||||
|
||||
bInMenuLoop = FALSE;
|
||||
// Update the status bar pane sizes
|
||||
/* Update the status bar pane sizes */
|
||||
GetClientRect(hWnd, &rc);
|
||||
nParts[0] = 100;
|
||||
nParts[1] = 210;
|
||||
|
@ -837,9 +810,9 @@ void TaskManager_OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMe
|
|||
|
||||
_tcscpy(str, TEXT(""));
|
||||
if (LoadString(hInst, nItemID, str, 100)) {
|
||||
// load appropriate string
|
||||
/* load appropriate string */
|
||||
LPTSTR lpsz = str;
|
||||
// first newline terminates actual string
|
||||
/* first newline terminates actual string */
|
||||
lpsz = _tcschr(lpsz, '\n');
|
||||
if (lpsz != NULL)
|
||||
*lpsz = '\0';
|
||||
|
@ -957,9 +930,9 @@ void TaskManager_OnTabWndSelChange(void)
|
|||
CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_SMALL, MF_BYCOMMAND);
|
||||
else
|
||||
CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_DETAILS, MF_BYCOMMAND);
|
||||
//
|
||||
// Give the application list control focus
|
||||
//
|
||||
/*
|
||||
* Give the application list control focus
|
||||
*/
|
||||
SetFocus(hApplicationPageListCtrl);
|
||||
break;
|
||||
|
||||
|
@ -977,9 +950,9 @@ void TaskManager_OnTabWndSelChange(void)
|
|||
RemoveMenu(hMenu, 3, MF_BYPOSITION);
|
||||
DrawMenuBar(hMainWnd);
|
||||
}
|
||||
//
|
||||
// Give the process list control focus
|
||||
//
|
||||
/*
|
||||
* Give the process list control focus
|
||||
*/
|
||||
SetFocus(hProcessPageListCtrl);
|
||||
break;
|
||||
|
||||
|
@ -1005,9 +978,9 @@ void TaskManager_OnTabWndSelChange(void)
|
|||
CheckMenuRadioItem(hSubMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, MF_BYCOMMAND);
|
||||
else
|
||||
CheckMenuRadioItem(hSubMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHALL, MF_BYCOMMAND);
|
||||
//
|
||||
// Give the tab control focus
|
||||
//
|
||||
/*
|
||||
* Give the tab control focus
|
||||
*/
|
||||
SetFocus(hTabWnd);
|
||||
break;
|
||||
}
|
||||
|
@ -1026,11 +999,11 @@ LPTSTR GetLastErrorText(LPTSTR lpszBuf, DWORD dwSize)
|
|||
0,
|
||||
NULL );
|
||||
|
||||
// supplied buffer is not long enough
|
||||
/* supplied buffer is not long enough */
|
||||
if (!dwRet || ( (long)dwSize < (long)dwRet+14)) {
|
||||
lpszBuf[0] = TEXT('\0');
|
||||
} else {
|
||||
lpszTemp[lstrlen(lpszTemp)-2] = TEXT('\0'); //remove cr and newline character
|
||||
lpszTemp[lstrlen(lpszTemp)-2] = TEXT('\0'); /*remove cr and newline character */
|
||||
_stprintf(lpszBuf, TEXT("%s (0x%x)"), lpszTemp, (int)GetLastError());
|
||||
}
|
||||
if (lpszTemp) {
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
/*
|
||||
* ReactOS Task Manager
|
||||
*
|
||||
* trayicon.cpp
|
||||
* trayicon.c
|
||||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -49,23 +49,23 @@ HICON TrayIcon_GetProcessorUsageIcon(void)
|
|||
HBRUSH hBitmapBrush = NULL;
|
||||
RECT rc;
|
||||
|
||||
//
|
||||
// Get a handle to the screen DC
|
||||
//
|
||||
/*
|
||||
* Get a handle to the screen DC
|
||||
*/
|
||||
hScreenDC = GetDC(NULL);
|
||||
if (!hScreenDC)
|
||||
goto done;
|
||||
|
||||
//
|
||||
// Create our own DC from it
|
||||
//
|
||||
/*
|
||||
* Create our own DC from it
|
||||
*/
|
||||
hDC = CreateCompatibleDC(hScreenDC);
|
||||
if (!hDC)
|
||||
goto done;
|
||||
|
||||
//
|
||||
// Load the bitmaps
|
||||
//
|
||||
/*
|
||||
* Load the bitmaps
|
||||
*/
|
||||
hBitmap = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_TRAYICON));
|
||||
hBitmapMask = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_TRAYMASK));
|
||||
if (!hBitmap || !hBitmapMask)
|
||||
|
@ -75,39 +75,39 @@ HICON TrayIcon_GetProcessorUsageIcon(void)
|
|||
if (!hBitmapBrush)
|
||||
goto done;
|
||||
|
||||
//
|
||||
// Select the bitmap into our device context
|
||||
// so we can draw on it.
|
||||
//
|
||||
/*
|
||||
* Select the bitmap into our device context
|
||||
* so we can draw on it.
|
||||
*/
|
||||
hOldBitmap = (HBITMAP) SelectObject(hDC, hBitmap);
|
||||
|
||||
//
|
||||
// Get the cpu usage
|
||||
//
|
||||
/*
|
||||
* Get the cpu usage
|
||||
*/
|
||||
ProcessorUsage = PerfDataGetProcessorUsage();
|
||||
|
||||
//
|
||||
// Calculate how many lines to draw
|
||||
// since we have 11 rows of space
|
||||
// to draw the cpu usage instead of
|
||||
// just having 10.
|
||||
//
|
||||
/*
|
||||
* Calculate how many lines to draw
|
||||
* since we have 11 rows of space
|
||||
* to draw the cpu usage instead of
|
||||
* just having 10.
|
||||
*/
|
||||
nLinesToDraw = (ProcessorUsage + (ProcessorUsage / 10)) / 11;
|
||||
rc.left = 3;
|
||||
rc.top = 12 - nLinesToDraw;
|
||||
rc.right = 13;
|
||||
rc.bottom = 13;
|
||||
|
||||
//
|
||||
// Now draw the cpu usage
|
||||
//
|
||||
/*
|
||||
* Now draw the cpu usage
|
||||
*/
|
||||
if (nLinesToDraw)
|
||||
FillRect(hDC, &rc, hBitmapBrush);
|
||||
|
||||
//
|
||||
// Now that we are done drawing put the
|
||||
// old bitmap back.
|
||||
//
|
||||
/*
|
||||
* Now that we are done drawing put the
|
||||
* old bitmap back.
|
||||
*/
|
||||
SelectObject(hDC, hOldBitmap);
|
||||
hOldBitmap = NULL;
|
||||
|
||||
|
@ -120,9 +120,9 @@ HICON TrayIcon_GetProcessorUsageIcon(void)
|
|||
hTrayIcon = CreateIconIndirect(&iconInfo);
|
||||
|
||||
done:
|
||||
//
|
||||
// Cleanup
|
||||
//
|
||||
/*
|
||||
* Cleanup
|
||||
*/
|
||||
if (hScreenDC)
|
||||
ReleaseDC(NULL, hScreenDC);
|
||||
if (hOldBitmap)
|
||||
|
@ -136,9 +136,9 @@ done:
|
|||
if (hBitmapMask)
|
||||
DeleteObject(hBitmapMask);
|
||||
|
||||
//
|
||||
// Return the newly created tray icon (if successful)
|
||||
//
|
||||
/*
|
||||
* Return the newly created tray icon (if successful)
|
||||
*/
|
||||
return hTrayIcon;
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ BOOL TrayIcon_ShellAddTrayIcon(void)
|
|||
nid.hWnd = hMainWnd;
|
||||
nid.uID = 0;
|
||||
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
|
||||
//nid.uCallbackMessage = ??;
|
||||
/* nid.uCallbackMessage = ??; */
|
||||
nid.hIcon = hIcon;
|
||||
wsprintf(nid.szTip, _T("CPU Usage: %d%%"), PerfDataGetProcessorUsage());
|
||||
|
||||
|
@ -179,7 +179,7 @@ BOOL TrayIcon_ShellRemoveTrayIcon(void)
|
|||
nid.hWnd = hMainWnd;
|
||||
nid.uID = 0;
|
||||
nid.uFlags = 0;
|
||||
//nid.uCallbackMessage = ??;
|
||||
/* nid.uCallbackMessage = ??; */
|
||||
|
||||
bRetVal = Shell_NotifyIcon(NIM_DELETE, &nid);
|
||||
|
||||
|
@ -200,7 +200,7 @@ BOOL TrayIcon_ShellUpdateTrayIcon(void)
|
|||
nid.hWnd = hMainWnd;
|
||||
nid.uID = 0;
|
||||
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
|
||||
//nid.uCallbackMessage = ??;
|
||||
/* nid.uCallbackMessage = ??; */
|
||||
nid.hIcon = hIcon;
|
||||
wsprintf(nid.szTip, _T("CPU Usage: %d%%"), PerfDataGetProcessorUsage());
|
||||
|
||||
|
|
Loading…
Reference in a new issue