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