⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpuandmemory.cpp

📁 用c++ 开发的中国象棋
💻 CPP
字号:
// CpuAndMemory.cpp : implementation file
//

#include "stdafx.h"
#include "chinesechess.h"
#include "CpuAndMemory.h"


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

/////////////////////////////////////////////////////////////////////////////
// CCpuAndMemory dialog


CCpuAndMemory::CCpuAndMemory(CWnd* pParent /*=NULL*/)
	: CDialog(CCpuAndMemory::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCpuAndMemory)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT

}


void CCpuAndMemory::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCpuAndMemory)
	DDX_Control(pDX, IDCANCEL, m_Cancle);
	DDX_Control(pDX, IDOK, m_Sure);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCpuAndMemory, CDialog)
	//{{AFX_MSG_MAP(CCpuAndMemory)
	ON_WM_CREATE()
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCpuAndMemory message handlers
int CCpuAndMemory::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	CRect rect(5,5,200,280);
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;

    if(!m_MyCpuCtrl.Create(WS_CHILD | WS_VISIBLE,
						   rect, this, IDC_CPUCTL
						   )
	 )
	{
		TRACE0("Create m_MyCtrl Failed!");
		return 0;
	}
	
	rect.left   = rect.right + 20;
	rect.right += 200;

	if(!m_MyMemCtrl.Create(WS_CHILD | WS_VISIBLE,
						   rect, this, IDC_MEMCTL
						   )
	 )
	{
		TRACE0("Create m_MyCtrl Failed!");
		return 0;
	}
	return 0;
}

void CCpuAndMemory::OnOK() 
{
	// TODO: Add extra validation here
	CDialog::OnOK();
	DestroyWindow();
}

void CCpuAndMemory::OnCancel() 
{
	// TODO: Add extra cleanup here
	
	CDialog::OnCancel();
	DestroyWindow();
}

void CCpuAndMemory::OnDestroy() 
{
	CDialog::OnDestroy();
	
	// TODO: Add your message handler code here
	delete this;//强行销毁,释放内存
}

BOOL CCpuAndMemory::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_MyCpuCtrl.SetRefreshInterval(1000);
	m_MyMemCtrl.SetRefreshInterval(1000);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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