Commit b72013d6 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

taskmgr: Avoid forward declarations and make functions static.

parent 0c02e467
...@@ -31,15 +31,7 @@ ...@@ -31,15 +31,7 @@
#include "taskmgr.h" #include "taskmgr.h"
INT_PTR CALLBACK AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
void OnAbout(void)
{
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hMainWnd, AboutDialogWndProc);
}
INT_PTR CALLBACK
AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
HWND hLicenseEditWnd; HWND hLicenseEditWnd;
TCHAR strLicense[0x1000]; TCHAR strLicense[0x1000];
...@@ -69,3 +61,8 @@ AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -69,3 +61,8 @@ AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
return 0; return 0;
} }
void OnAbout(void)
{
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hMainWnd, AboutDialogWndProc);
}
...@@ -35,41 +35,7 @@ ...@@ -35,41 +35,7 @@
HANDLE hProcessAffinityHandle; HANDLE hProcessAffinityHandle;
INT_PTR CALLBACK AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK
void ProcessPage_OnSetAffinity(void)
{
LV_ITEM lvitem;
ULONG Index;
DWORD dwProcessId;
TCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) {
memset(&lvitem, 0, sizeof(LV_ITEM));
lvitem.mask = LVIF_STATE;
lvitem.stateMask = LVIS_SELECTED;
lvitem.iItem = Index;
SendMessage(hProcessPageListCtrl, LVM_GETITEM, 0, (LPARAM) &lvitem);
if (lvitem.state & LVIS_SELECTED)
break;
}
dwProcessId = PerfDataGetProcessId(Index);
if ((ListView_GetSelectedCount(hProcessPageListCtrl) != 1) || (dwProcessId == 0))
return;
hProcessAffinityHandle = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, FALSE, dwProcessId);
if (!hProcessAffinityHandle) {
GetLastErrorText(strErrorText, 260);
MessageBox(hMainWnd, strErrorText, _T("Unable to Access or Set Process Affinity"), MB_OK|MB_ICONSTOP);
return;
}
DialogBox(hInst, MAKEINTRESOURCE(IDD_AFFINITY_DIALOG), hMainWnd, AffinityDialogWndProc);
if (hProcessAffinityHandle) {
CloseHandle(hProcessAffinityHandle);
hProcessAffinityHandle = NULL;
}
}
INT_PTR CALLBACK
AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
DWORD dwProcessAffinityMask = 0; DWORD dwProcessAffinityMask = 0;
...@@ -343,3 +309,35 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -343,3 +309,35 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
return 0; return 0;
} }
void ProcessPage_OnSetAffinity(void)
{
LV_ITEM lvitem;
ULONG Index;
DWORD dwProcessId;
TCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) {
memset(&lvitem, 0, sizeof(LV_ITEM));
lvitem.mask = LVIF_STATE;
lvitem.stateMask = LVIS_SELECTED;
lvitem.iItem = Index;
SendMessage(hProcessPageListCtrl, LVM_GETITEM, 0, (LPARAM) &lvitem);
if (lvitem.state & LVIS_SELECTED)
break;
}
dwProcessId = PerfDataGetProcessId(Index);
if ((ListView_GetSelectedCount(hProcessPageListCtrl) != 1) || (dwProcessId == 0))
return;
hProcessAffinityHandle = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, FALSE, dwProcessId);
if (!hProcessAffinityHandle) {
GetLastErrorText(strErrorText, 260);
MessageBox(hMainWnd, strErrorText, _T("Unable to Access or Set Process Affinity"), MB_OK|MB_ICONSTOP);
return;
}
DialogBox(hInst, MAKEINTRESOURCE(IDD_AFFINITY_DIALOG), hMainWnd, AffinityDialogWndProc);
if (hProcessAffinityHandle) {
CloseHandle(hProcessAffinityHandle);
hProcessAffinityHandle = NULL;
}
}
...@@ -40,110 +40,7 @@ ...@@ -40,110 +40,7 @@
WNDPROC OldGraphWndProc; WNDPROC OldGraphWndProc;
void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd); static void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd);
void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd);
INT_PTR CALLBACK
Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
LONG WindowId;
switch (message)
{
case WM_ERASEBKGND:
return TRUE;
/*
* Filter out mouse & keyboard messages
*/
/* case WM_APPCOMMAND: */
case WM_CAPTURECHANGED:
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MBUTTONDBLCLK:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_MOUSEACTIVATE:
case WM_MOUSEHOVER:
case WM_MOUSELEAVE:
case WM_MOUSEMOVE:
/* case WM_MOUSEWHEEL: */
case WM_NCHITTEST:
case WM_NCLBUTTONDBLCLK:
case WM_NCLBUTTONDOWN:
case WM_NCLBUTTONUP:
case WM_NCMBUTTONDBLCLK:
case WM_NCMBUTTONDOWN:
case WM_NCMBUTTONUP:
/* case WM_NCMOUSEHOVER: */
/* case WM_NCMOUSELEAVE: */
case WM_NCMOUSEMOVE:
case WM_NCRBUTTONDBLCLK:
case WM_NCRBUTTONDOWN:
case WM_NCRBUTTONUP:
/* case WM_NCXBUTTONDBLCLK: */
/* case WM_NCXBUTTONDOWN: */
/* case WM_NCXBUTTONUP: */
case WM_RBUTTONDBLCLK:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
/* case WM_XBUTTONDBLCLK: */
/* case WM_XBUTTONDOWN: */
/* case WM_XBUTTONUP: */
case WM_ACTIVATE:
case WM_CHAR:
case WM_DEADCHAR:
case WM_GETHOTKEY:
case WM_HOTKEY:
case WM_KEYDOWN:
case WM_KEYUP:
case WM_KILLFOCUS:
case WM_SETFOCUS:
case WM_SETHOTKEY:
case WM_SYSCHAR:
case WM_SYSDEADCHAR:
case WM_SYSKEYDOWN:
case WM_SYSKEYUP:
case WM_NCCALCSIZE:
return 0;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
WindowId = GetWindowLongPtr(hWnd, GWLP_ID);
switch (WindowId)
{
case IDC_CPU_USAGE_GRAPH:
Graph_DrawCpuUsageGraph(hdc, hWnd);
break;
case IDC_MEM_USAGE_GRAPH:
Graph_DrawMemUsageGraph(hdc, hWnd);
break;
case IDC_MEM_USAGE_HISTORY_GRAPH:
Graph_DrawMemUsageHistoryGraph(hdc, hWnd);
break;
}
EndPaint(hWnd, &ps);
return 0;
}
/*
* We pass on all non-handled messages
*/
return CallWindowProc((WNDPROC)OldGraphWndProc, hWnd, message, wParam, lParam);
}
void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
{ {
RECT rcClient; RECT rcClient;
RECT rcBarLeft; RECT rcBarLeft;
...@@ -323,7 +220,7 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd) ...@@ -323,7 +220,7 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
} }
} }
void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd) static void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
{ {
RECT rcClient; RECT rcClient;
RECT rcBarLeft; RECT rcBarLeft;
...@@ -418,7 +315,7 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd) ...@@ -418,7 +315,7 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
} }
} }
void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd) static void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd)
{ {
RECT rcClient; RECT rcClient;
ULONGLONG CommitChargeLimit; ULONGLONG CommitChargeLimit;
...@@ -473,3 +370,102 @@ void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd) ...@@ -473,3 +370,102 @@ void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd)
{ {
} }
} }
INT_PTR CALLBACK
Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
LONG WindowId;
switch (message)
{
case WM_ERASEBKGND:
return TRUE;
/*
* Filter out mouse & keyboard messages
*/
/* case WM_APPCOMMAND: */
case WM_CAPTURECHANGED:
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MBUTTONDBLCLK:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_MOUSEACTIVATE:
case WM_MOUSEHOVER:
case WM_MOUSELEAVE:
case WM_MOUSEMOVE:
/* case WM_MOUSEWHEEL: */
case WM_NCHITTEST:
case WM_NCLBUTTONDBLCLK:
case WM_NCLBUTTONDOWN:
case WM_NCLBUTTONUP:
case WM_NCMBUTTONDBLCLK:
case WM_NCMBUTTONDOWN:
case WM_NCMBUTTONUP:
/* case WM_NCMOUSEHOVER: */
/* case WM_NCMOUSELEAVE: */
case WM_NCMOUSEMOVE:
case WM_NCRBUTTONDBLCLK:
case WM_NCRBUTTONDOWN:
case WM_NCRBUTTONUP:
/* case WM_NCXBUTTONDBLCLK: */
/* case WM_NCXBUTTONDOWN: */
/* case WM_NCXBUTTONUP: */
case WM_RBUTTONDBLCLK:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
/* case WM_XBUTTONDBLCLK: */
/* case WM_XBUTTONDOWN: */
/* case WM_XBUTTONUP: */
case WM_ACTIVATE:
case WM_CHAR:
case WM_DEADCHAR:
case WM_GETHOTKEY:
case WM_HOTKEY:
case WM_KEYDOWN:
case WM_KEYUP:
case WM_KILLFOCUS:
case WM_SETFOCUS:
case WM_SETHOTKEY:
case WM_SYSCHAR:
case WM_SYSDEADCHAR:
case WM_SYSKEYDOWN:
case WM_SYSKEYUP:
case WM_NCCALCSIZE:
return 0;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
WindowId = GetWindowLongPtr(hWnd, GWLP_ID);
switch (WindowId)
{
case IDC_CPU_USAGE_GRAPH:
Graph_DrawCpuUsageGraph(hdc, hWnd);
break;
case IDC_MEM_USAGE_GRAPH:
Graph_DrawMemUsageGraph(hdc, hWnd);
break;
case IDC_MEM_USAGE_HISTORY_GRAPH:
Graph_DrawMemUsageHistoryGraph(hdc, hWnd);
break;
}
EndPaint(hWnd, &ps);
return 0;
}
/*
* We pass on all non-handled messages
*/
return CallWindowProc((WNDPROC)OldGraphWndProc, hWnd, message, wParam, lParam);
}
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
#include "perfdata.h" #include "perfdata.h"
LRESULT CALLBACK ProcessListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
WNDPROC OldProcessListWndProc; WNDPROC OldProcessListWndProc;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment