Sync'ing remaining changes after recent CVS problems. Seem to now have my route back!

svn path=/trunk/; revision=3540
This commit is contained in:
Robert Dickenson 2002-09-24 14:22:48 +00:00
parent 5902c7241e
commit edfa8a7002
7 changed files with 928 additions and 880 deletions

View file

@ -181,15 +181,15 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
//
if (CpuUsage == 100)
{
_stprintf(Text, _T("%d%%"), CpuUsage);
_stprintf(Text, _T("%d%%"), (int)CpuUsage);
}
else if (CpuUsage < 10)
{
_stprintf(Text, _T(" %d%%"), CpuUsage);
_stprintf(Text, _T(" %d%%"), (int)CpuUsage);
}
else
{
_stprintf(Text, _T(" %d%%"), CpuUsage);
_stprintf(Text, _T(" %d%%"), (int)CpuUsage);
}
//
@ -347,7 +347,7 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
CommitChargeTotal = (ULONGLONG)PerfDataGetCommitChargeTotalK();
CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
_stprintf(Text, _T("%dK"), CommitChargeTotal);
_stprintf(Text, _T("%dK"), (int)CommitChargeTotal);
//
// Draw the font text onto the graph

View file

@ -4,6 +4,7 @@
# Makefile
#
# Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
# Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -20,76 +21,85 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
PATH_TO_TOP = ..
#export CPP = g++
#export LD = ld
#export AR = ar
#export RM = cmd /C del
#export CP = cmd /C copy
TARGET = taskmgr
FLAGS = -D_WIN32_IE=0x0400 -g
BASE_CFLAGS = -DGCC -D_WIN32_IE=0x0400
RCFLAGS = -DGCC -D_WIN32_IE=0x0400
OBJS = about.o \
affinity.o \
applpage.o \
column.o \
debug.o \
endproc.o \
font.o \
graph.o \
optnmenu.o \
perfdata.o \
perfpage.o \
priority.o \
procpage.o \
proclist.o \
run.o \
trayicon.o \
taskmgr.o \
graphctl.o
OBJS = about.o affinity.o applpage.o column.o debug.o endproc.o font.o \
graph.o optnmenu.o perfdata.o perfpage.o priority.o procpage.o \
proclist.o run.o trayicon.o taskmgr.o
LIBS = -lgdi32 -luser32 -lkernel32 -lcomctl32
all: taskmgr.exe
taskmgr.exe: $(OBJS)
$(CPP) -g -o taskmgr.exe $(OBJS) $(LIBS)
taskmgr.res: taskmgr.rc
about.o: about.c about.h
$(CPP) $(FLAGS) -o about.o -c about.c
taskmgr.exe: $(OBJS) taskmgr.coff
$(CPP) -Wl,--subsystem,windows -o taskmgr.exe $(OBJS) taskmgr.coff $(LIBS)
$(NM) --numeric-sort taskmgr.exe > taskmgr.sym
about.o: about.c about.h resource.h
affinity.o: affinity.c affinity.h
$(CPP) $(FLAGS) -o affinity.o -c affinity.c
applpage.o: applpage.c applpage.h
$(CPP) $(FLAGS) -o applpage.o -c applpage.c
applpage.o: applpage.c applpage.h procpage.h taskmgr.h resource.h
column.o: column.c column.h
$(CPP) $(FLAGS) -o column.o -c column.c
column.o: column.c column.h resource.h
debug.o: debug.c debug.h
$(CPP) $(FLAGS) -o debug.o -c debug.c
endproc.o: endproc.c endproc.h
$(CPP) $(FLAGS) -o endproc.o -c endproc.c
font.o: font.c font.h
$(CPP) $(FLAGS) -o font.o -c font.c
graph.o: graph.c graph.h
$(CPP) $(FLAGS) -o graph.o -c graph.c
graph.o: graph.c graph.h resource.h
optnmenu.o: optnmenu.c optnmenu.h
$(CPP) $(FLAGS) -o optnmenu.o -c optnmenu.c
graphctl.o: graphctl.cpp graphctl.h resource.h
optnmenu.o: optnmenu.c optnmenu.h resource.h
perfdata.o: perfdata.c perfdata.h
$(CPP) $(FLAGS) -o perfdata.o -c perfdata.c
perfpage.o: perfpage.cpp perfpage.h
$(CPP) $(FLAGS) -o perfpage.o -c perfpage.cpp
perfpage.o: perfpage.cpp perfpage.h perfdata.h graphctl.h graph.h taskmgr.h resource.h
priority.o: priority.c priority.h
$(CPP) $(FLAGS) -o priority.o -c priority.c
procpage.o: procpage.c procpage.h
$(CPP) $(FLAGS) -o procpage.o -c procpage.c
procpage.o: procpage.c procpage.h perfdata.h column.h proclist.h taskmgr.h resource.h
proclist.o: proclist.c proclist.h
$(CPP) $(FLAGS) -o proclist.o -c proclist.c
run.o: run.c run.h
$(CPP) $(FLAGS) -o run.o -c run.c
trayicon.o: trayicon.c trayicon.h
$(CPP) $(FLAGS) -o trayicon.o -c trayicon.c
trayicon.o: trayicon.c trayicon.h resource.h
taskmgr.o: taskmgr.c taskmgr.h
$(CPP) $(FLAGS) -o taskmgr.o -c taskmgr.c
taskmgr.o: taskmgr.c taskmgr.h resource.h
clean:
- $(RM) $(OBJS)
- $(RM) taskmgr.exe
- $(RM) taskmgr.sym
- $(RM) taskmgr.coff
include $(PATH_TO_TOP)/rules.mak

View file

@ -44,9 +44,9 @@ ULONG ProcessCount = 0;
double dbIdleTime;
double dbKernelTime;
double dbSystemTime;
LARGE_INTEGER liOldIdleTime = {0,0};
LARGE_INTEGER liOldIdleTime = {{0,0}};
double OldKernelTime = 0;
LARGE_INTEGER liOldSystemTime = {0,0};
LARGE_INTEGER liOldSystemTime = {{0,0}};
SYSTEM_PERFORMANCE_INFORMATION SystemPerfInfo;
SYSTEM_BASIC_INFORMATION SystemBasicInfo;
SYSTEM_CACHE_INFORMATION SystemCacheInfo;
@ -441,7 +441,7 @@ ULONG PerfDataGetCPUUsage(ULONG Index)
TIME PerfDataGetCPUTime(ULONG Index)
{
TIME CpuTime = {0,0};
TIME CpuTime = {{0,0}};
EnterCriticalSection(&PerfDataCriticalSection);

View file

@ -98,7 +98,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
#define _USE_CMD_MAP
#ifdef _USE_CMD_MAP
#define BEGIN_CMD_MAP(a) switch(##a) {
#define BEGIN_CMD_MAP(a) switch( ##a ) {
#define CMD_MAP_ENTRY(a, b) case a: b(); break;
#define END_CMD_MAP(a) }
@ -126,7 +126,7 @@ LRESULT CALLBACK TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
return TRUE;
}
#ifdef _USE_CMD_MAP
BEGIN_CMD_MAP(LOWORD(wParam))
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)
@ -1012,7 +1012,7 @@ void TaskManager_OnTabWndSelChange(void)
}
}
LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize )
LPTSTR GetLastErrorText(LPTSTR lpszBuf, DWORD dwSize)
{
DWORD dwRet;
LPTSTR lpszTemp = NULL;
@ -1026,11 +1026,11 @@ LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize )
NULL );
// supplied buffer is not long enough
if (!dwRet || ( (long)dwSize < (long)dwRet+14 )) {
if (!dwRet || ( (long)dwSize < (long)dwRet+14)) {
lpszBuf[0] = TEXT('\0');
} else {
lpszTemp[lstrlen(lpszTemp)-2] = TEXT('\0'); //remove cr and newline character
_stprintf(lpszBuf, TEXT("%s (0x%x)"), lpszTemp, GetLastError() );
_stprintf(lpszBuf, TEXT("%s (0x%x)"), lpszTemp, (int)GetLastError());
}
if (lpszTemp) {
LocalFree((HLOCAL)lpszTemp);

View file

@ -20,16 +20,42 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __TASKMGR_H__
#define __TASKMGR_H__
#if !defined(AFX_TASKMGR_H__392F6393_0279_11D3_9C02_004005E27102__INCLUDED_)
#define AFX_TASKMGR_H__392F6393_0279_11D3_9C02_004005E27102__INCLUDED_
#ifdef __cplusplus
extern "C" {
#endif
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifdef _MSC_VER
typedef struct _IO_COUNTERS {
ULONGLONG ReadOperationCount;
ULONGLONG WriteOperationCount;
ULONGLONG OtherOperationCount;
ULONGLONG ReadTransferCount;
ULONGLONG WriteTransferCount;
ULONGLONG OtherTransferCount;
} IO_COUNTERS, *PIO_COUNTERS;
#else
#if __MINGW32_MAJOR_VERSION == 1
#define HDITEM HD_ITEM
#define LPNMLISTVIEW LPNM_LISTVIEW
#define HDN_ENDDRAG TBN_ENDDRAG
#define LVSICF_NOSCROLL LVS_NOSCROLL
#define HDM_GETORDERARRAY (HDM_FIRST+19) // TODO: FIX ME
#endif
#endif
#include "resource.h"
#define RUN_APPS_PAGE
#define RUN_PROC_PAGE
#define RUN_PERF_PAGE
#define STATUS_WINDOW 2001
@ -114,12 +140,13 @@ extern TASKMANAGER_SETTINGS TaskManagerSettings;
LRESULT CALLBACK TaskManagerWndProc(HWND, UINT, WPARAM, LPARAM);
BOOL OnCreate(HWND hWnd);
void OnSize( UINT nType, int cx, int cy );
void OnSize(UINT nType, int cx, int cy);
void OnMove(UINT nType, int cx, int cy);
void FillSolidRect(HDC hDC, LPCRECT lpRect, COLORREF clr);
void FillSolidRect(HDC hDC, int x, int y, int cx, int cy, COLORREF clr);
void FillSolidRect2(HDC hDC, int x, int y, int cx, int cy, COLORREF clr);
void Draw3dRect(HDC hDC, int x, int y, int cx, int cy, COLORREF clrTopLeft, COLORREF clrBottomRight);
void Draw3dRect(HDC hDC, LPRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight);
void Draw3dRect2(HDC hDC, LPRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight);
void LoadSettings(void);
void SaveSettings(void);
@ -132,9 +159,15 @@ void TaskManager_OnViewUpdateSpeedHigh(void);
void TaskManager_OnViewUpdateSpeedNormal(void);
void TaskManager_OnViewUpdateSpeedLow(void);
void TaskManager_OnViewUpdateSpeedPaused(void);
void TaskManager_OnViewRefresh(void);
void TaskManager_OnTabWndSelChange(void);
LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize );
#endif // !defined(AFX_TASKMGR_H__392F6393_0279_11D3_9C02_004005E27102__INCLUDED_)
#ifdef __cplusplus
};
#endif
#endif // __TASKMGR_H__

View file

@ -8,7 +8,13 @@
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#ifdef __GNUC__
#include <windows.h>
//#include <reactos/resource.h>
#include <commctrl.h>
#else
#include "windows.h"
#endif
#undef APSTUDIO_HIDDEN_SYMBOLS
#include "resource.h"
@ -200,7 +206,7 @@ BEGIN
END
IDD_APPLICATION_PAGE DIALOG DISCARDABLE 0, 0, 247, 210
STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN
STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "Tahoma"
BEGIN
CONTROL "List2",IDC_APPLIST,"SysListView32",LVS_REPORT |
@ -222,62 +228,61 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,191,111,10
END
IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
STYLE DS_CONTROL | WS_CHILD
//IDD_PERFORMANCE_PAGE DIALOGEX 0, 0, 247, 210
IDD_PERFORMANCE_PAGE DIALOG DISCARDABLE 0, 0, 247, 210
STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "Tahoma"
BEGIN
GROUPBOX "CPU Usage",IDC_CPU_USAGE_FRAME,5,5,60,54,WS_TABSTOP
GROUPBOX "MEM Usage",IDC_MEM_USAGE_FRAME,5,63,60,54
GROUPBOX "Totals",IDC_TOTALS_FRAME,5,122,111,39
GROUPBOX "Commit Charge (K)",IDC_COMMIT_CHARGE_FRAME,5,166,111,39
GROUPBOX "Physical Memory (K)",IDC_PHYSICAL_MEMORY_FRAME,131,122,
111,39
GROUPBOX "Kernel Memory (K)",IDC_KERNEL_MEMORY_FRAME,131,166,111,
39
LTEXT "Handles",IDC_STATIC,12,131,27,8
LTEXT "Threads",IDC_STATIC,12,140,27,8
LTEXT "Processes",IDC_STATIC,12,149,34,8
GROUPBOX "CPU Usage",IDC_CPU_USAGE_FRAME,5,5,60,54,WS_TABSTOP, WS_EX_TRANSPARENT
GROUPBOX "MEM Usage",IDC_MEM_USAGE_FRAME,5,63,60,54,BS_LEFTTEXT, WS_EX_TRANSPARENT
GROUPBOX "Totals",IDC_TOTALS_FRAME,5,122,111,39,0,WS_EX_TRANSPARENT
GROUPBOX "Commit Charge (K)",IDC_COMMIT_CHARGE_FRAME,5,166,111,39,0,WS_EX_TRANSPARENT
GROUPBOX "Physical Memory (K)",IDC_PHYSICAL_MEMORY_FRAME,131,122,111,39,0,WS_EX_TRANSPARENT
GROUPBOX "Kernel Memory (K)",IDC_KERNEL_MEMORY_FRAME,131,166,111,39,0,WS_EX_TRANSPARENT
LTEXT "Handles",IDS_TOTALS_HANDLE_COUNT,12,131,27,8
LTEXT "Threads",IDS_TOTALS_THREAD_COUNT,12,140,27,8
LTEXT "Processes",IDS_TOTALS_PROCESS_COUNT,12,149,34,8
EDITTEXT IDC_TOTALS_HANDLE_COUNT,65,131,45,8,ES_RIGHT |
ES_READONLY | ES_NUMBER | NOT WS_BORDER
EDITTEXT IDC_TOTALS_THREAD_COUNT,65,140,45,8,ES_RIGHT |
ES_READONLY | ES_NUMBER | NOT WS_BORDER
EDITTEXT IDC_TOTALS_PROCESS_COUNT,65,149,45,8,ES_RIGHT |
ES_READONLY | ES_NUMBER | NOT WS_BORDER
LTEXT "Total",IDC_STATIC,12,175,27,8
LTEXT "Limit",IDC_STATIC,12,184,15,8
LTEXT "Peak",IDC_STATIC,12,193,34,8
LTEXT "Total",IDS_COMMIT_CHARGE_TOTAL,12,175,27,8
LTEXT "Limit",IDS_COMMIT_CHARGE_LIMIT,12,184,15,8
LTEXT "Peak",IDS_COMMIT_CHARGE_PEAK,12,193,34,8
EDITTEXT IDC_COMMIT_CHARGE_TOTAL,65,174,45,8,ES_RIGHT |
ES_READONLY | ES_NUMBER | NOT WS_BORDER
EDITTEXT IDC_COMMIT_CHARGE_LIMIT,65,184,45,8,ES_RIGHT |
ES_READONLY | ES_NUMBER | NOT WS_BORDER
EDITTEXT IDC_COMMIT_CHARGE_PEAK,65,193,45,8,ES_RIGHT |
ES_READONLY | ES_NUMBER | NOT WS_BORDER
LTEXT "Total",IDC_STATIC,137,131,27,8
LTEXT "Available",IDC_STATIC,137,140,30,8
LTEXT "System Cache",IDC_STATIC,137,149,46,8
LTEXT "Total",IDS_PHYSICAL_MEMORY_TOTAL,137,131,27,8
LTEXT "Available",IDS_PHYSICAL_MEMORY_AVAILABLE,137,140,30,8
LTEXT "System Cache",IDS_PHYSICAL_MEMORY_SYSTEM_CACHE,137,149,46,8
EDITTEXT IDC_PHYSICAL_MEMORY_TOTAL,185,131,48,8,ES_RIGHT |
ES_READONLY | ES_NUMBER | NOT WS_BORDER
EDITTEXT IDC_PHYSICAL_MEMORY_AVAILABLE,185,140,48,8,ES_RIGHT |
ES_READONLY | ES_NUMBER | NOT WS_BORDER
EDITTEXT IDC_PHYSICAL_MEMORY_SYSTEM_CACHE,185,149,48,8,ES_RIGHT |
ES_READONLY | ES_NUMBER | NOT WS_BORDER
LTEXT "Total",IDC_STATIC,137,174,27,8
LTEXT "Paged",IDC_STATIC,137,184,21,8
LTEXT "Nonpaged",IDC_STATIC,137,193,34,8
LTEXT "Total",IDS_KERNEL_MEMORY_TOTAL,137,174,27,8
LTEXT "Paged",IDS_KERNEL_MEMORY_PAGED,137,184,21,8
LTEXT "Nonpaged",IDS_KERNEL_MEMORY_NONPAGED,137,193,34,8
EDITTEXT IDC_KERNEL_MEMORY_TOTAL,185,174,48,8,ES_RIGHT |
ES_READONLY | ES_NUMBER | NOT WS_BORDER
EDITTEXT IDC_KERNEL_MEMORY_PAGED,185,184,48,8,ES_RIGHT |
ES_READONLY | ES_NUMBER | NOT WS_BORDER
EDITTEXT IDC_KERNEL_MEMORY_NONPAGED,185,193,48,8,ES_RIGHT |
ES_READONLY | ES_NUMBER | NOT WS_BORDER
GROUPBOX "CPU Usage History",IDC_CPU_USAGE_HISTORY_FRAME,74,5,168,
54
GROUPBOX "Memory Usage History",IDC_MEMORY_USAGE_HISTORY_FRAME,74,
63,168,54
GROUPBOX "CPU Usage History",IDC_CPU_USAGE_HISTORY_FRAME,74,5,168,54,0,WS_EX_TRANSPARENT
GROUPBOX "Memory Usage History",IDC_MEMORY_USAGE_HISTORY_FRAME,74,63,168,54,0,WS_EX_TRANSPARENT
PUSHBUTTON "CPU Usage Display",IDC_CPU_USAGE_GRAPH,12,17,47,37,0,
WS_EX_CLIENTEDGE
PUSHBUTTON "MEM Usage Display",IDC_MEM_USAGE_GRAPH,12,75,47,37,0,
WS_EX_CLIENTEDGE
PUSHBUTTON "CPU Usage History",IDC_CPU_USAGE_HISTORY_GRAPH,81,17,
153,37,0,WS_EX_CLIENTEDGE
PUSHBUTTON "MEM Usage History",IDC_MEM_USAGE_HISTORY_GRAPH,81,75,
153,37,0,WS_EX_CLIENTEDGE
END
@ -540,9 +545,9 @@ END
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_TASKMANAGER ICON DISCARDABLE "taskmgr.ico"
IDI_WINDOW ICON DISCARDABLE "window.ico"
IDI_WINDOWSM ICON DISCARDABLE "windowsm.ico"
IDI_TASKMANAGER ICON DISCARDABLE "res/taskmgr.ico"
IDI_WINDOW ICON DISCARDABLE "res/window.ico"
IDI_WINDOWSM ICON DISCARDABLE "res/windowsm.ico"
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
@ -591,9 +596,9 @@ END
// Bitmap
//
IDB_TRAYMASK BITMAP DISCARDABLE "traymask.bmp"
IDB_TRAYICON BITMAP DISCARDABLE "trayicon.bmp"
IDB_FONT BITMAP DISCARDABLE "font.bmp"
IDB_TRAYMASK BITMAP DISCARDABLE "res/traymask.bmp"
IDB_TRAYICON BITMAP DISCARDABLE "res/trayicon.bmp"
IDB_FONT BITMAP DISCARDABLE "res/font.bmp"
/////////////////////////////////////////////////////////////////////////////
//