-
Notifications
You must be signed in to change notification settings - Fork 1
/
OSInfoItemDlg.cpp
118 lines (87 loc) · 2.55 KB
/
OSInfoItemDlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// OSInfoItemDlg.cpp : implementation file
//
#include "stdafx.h"
#include "CPUBench2004.h"
#include "OSInfoItemDlg.h"
#include "gradient.h"
#include "itembkdrawer.h"
#include "memoryinfo.h"
#include "sysinfodlg.h"
#include "osinformations.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COSInfoItemDlg dialog
COSInfoItemDlg::COSInfoItemDlg(CWnd* pParent /*=NULL*/)
: CDialog(COSInfoItemDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(COSInfoItemDlg)
m_memFreeVal = _T("");
m_osName = _T("");
//}}AFX_DATA_INIT
}
void COSInfoItemDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COSInfoItemDlg)
DDX_Control(pDX, IDC_MEMFREE, m_memFree);
DDX_Control(pDX, IDC_MORE, m_osDetails);
DDX_Text(pDX, IDC_MEMFREEVAL, m_memFreeVal);
DDX_Text(pDX, IDC_OSNAME, m_osName);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COSInfoItemDlg, CDialog)
//{{AFX_MSG_MAP(COSInfoItemDlg)
ON_WM_ERASEBKGND()
ON_WM_CTLCOLOR()
ON_BN_CLICKED(IDC_MORE, OnMore)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COSInfoItemDlg message handlers
BOOL COSInfoItemDlg::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
}
HBRUSH COSInfoItemDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor == CTLCOLOR_STATIC){
pDC->SetBkMode(TRANSPARENT);
//pDC->SetTextColor(RGB(0,0x74,0xDC));
return (HBRUSH)GetStockObject(NULL_BRUSH);
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
BOOL COSInfoItemDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CMemoryInfo memInfo;
COSInformations osInfo;
m_memFree.SetRange(0,100);
m_memFree.SetAlertPos(30);
m_memFree.SetPos(memInfo.GetRAMAvailablePercent());
m_memFreeVal=memInfo.GetRAMAvailable();
m_osName=osInfo.GetOSName()+" ("+osInfo.GetOSRevision()+")";
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void COSInfoItemDlg::OnMore()
{
CSysInfoDlg dlg;
dlg.DoModal();
}
void COSInfoItemDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect r;
GetClientRect(&r);
CItemBkDrawer::DrawBk(&dc,&r);
// Do not call CDialog::OnPaint() for painting messages
}