initdlg.cpp

来自「用VC开发的模拟操作系统的页面置换」· C++ 代码 · 共 101 行

CPP
101
字号
// InitDlg.cpp : implementation file
//

#include "stdafx.h"
#include "WIN页面置换.h"
#include "InitDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CInitDlg dialog


CInitDlg::CInitDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CInitDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CInitDlg)
	m_PAGESIZE = _T("1");
	m_PROGRAMSIZE = _T("32");
	m_DictateNum = 256;
	//}}AFX_DATA_INIT
}


void CInitDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CInitDlg)
	DDX_CBString(pDX, IDC_PAGESIZE, m_PAGESIZE);
	DDX_CBString(pDX, IDC_PROGRAMSIZE, m_PROGRAMSIZE);
	DDX_Text(pDX, IDC_DICTATE, m_DictateNum);
	DDV_MinMaxInt(pDX, m_DictateNum, 0, 1024);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CInitDlg, CDialog)
	//{{AFX_MSG_MAP(CInitDlg)
	ON_BN_CLICKED(IDC_FIFO, OnFifo)
	ON_BN_CLICKED(IDC_LRU, OnLru)
	ON_BN_CLICKED(IDC_OPT, OnOpt)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CInitDlg message handlers

void CInitDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(true);
   if((m_PAGESIZE=="")||(m_PROGRAMSIZE=="")||(m_arithmetic==""))
   {
	   MessageBox("输入数据错误","警告信息",MB_OK);

   }
   else{
	   m_pagesize=atoi(m_PAGESIZE);
	   m_programsize=atoi(m_PROGRAMSIZE);
       extern int m_chengxu, m_text,m_ye;
	   m_chengxu=m_programsize;
	   m_ye=m_pagesize;
	   m_text=m_DictateNum;
	CDialog::OnOK();
   }
}

BOOL CInitDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_pagesize=0;
	m_programsize=0;
	m_arithmetic=_T("");
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CInitDlg::OnFifo() 
{
	// TODO: Add your control notification handler code here
	m_arithmetic="FIFO算法";
}

void CInitDlg::OnLru() 
{
	// TODO: Add your control notification handler code here
	m_arithmetic="LRU算法";
}

void CInitDlg::OnOpt() 
{
	// TODO: Add your control notification handler code here
	m_arithmetic="OPT算法";
}

⌨️ 快捷键说明

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