docomputer.cpp

来自「memory management」· C++ 代码 · 共 94 行

CPP
94
字号
// Docomputer.cpp : implementation file
//

#include "stdafx.h"
#include "Memory.h"
#include "Docomputer.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDocomputer dialog


CDocomputer::CDocomputer(CWnd* pParent /*=NULL*/)
	: CDialog(CDocomputer::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDocomputer)
	m_doComputer = 0;
	//}}AFX_DATA_INIT
}


void CDocomputer::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDocomputer)
	DDX_Control(pDX, IDC_LINE, m_line);
	DDX_Radio(pDX, IDC_RESTART, m_doComputer);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDocomputer, CDialog)
	//{{AFX_MSG_MAP(CDocomputer)
	ON_BN_CLICKED(ID_START, OnStart)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDocomputer message handlers

void CDocomputer::OnStart() 
{
	UpdateData(true);
	Doid=GetCheckedRadioButton(IDC_RESTART,IDC_UNREG);
	switch(Doid)
	{
	case IDC_RESTART:
		ExitWindowsEx(EWX_REBOOT,0);
		break;
	case IDC_CANCLOSE:
		ExitWindowsEx(EWX_SHUTDOWN,0);
		break;
	case IDC_CLOSE:
		ExitWindowsEx(EWX_FORCE,0);
		break;
	case IDC_UNREG:
		ExitWindowsEx(EWX_LOGOFF,0);
		break;
	}

}

BOOL CDocomputer::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	//CheckRadioButton(IDC_RESTART,IDC_UNREG,IDC_RESTART);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDocomputer::OnPaint() 
{
	//CDialog::OnPaint(); // device context for painting
	
	CPaintDC dc(&m_line);
	COLORREF clrHilight=GetSysColor(COLOR_BTNHILIGHT);
	COLORREF clrShadow=GetSysColor(COLOR_BTNSHADOW);
	CRect rect;
	m_line.GetClientRect(&rect);
	rect.top=rect.bottom/2;
	rect.bottom=rect.top+3;
	//dc.MoveTo(rect.left,rect.top);
	//dc.LineTo(rect.right,rect.top);
	dc.Draw3dRect(rect,clrShadow,clrHilight);
	// Do not call CDialog::OnPaint() for painting messages
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?