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

📄 descdlg.cpp

📁 一个硬件测试工具的源代码
💻 CPP
字号:
// DescDlg.cpp : implementation file
//

#include <afxwin.h>
#include "clibench.h"
#include "DescDlg.h"
#include "resource.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDescDlg dialog


CDescDlg::CDescDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CDescDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDescDlg)
	okay=false;
	if ((atoi(descs[0][12]))==0)
		{
		m_nofthreads=1;
		}
	else
		{
		m_nofthreads= _T(atoi(descs[0][12]));
		}
	m_nofcpus= _T(descs[0][13]);
	m_board = _T(descs[0][2]);
	m_brand = _T(descs[0][0]);
	m_cachesize = _T(descs[0][6]);
	m_cachetype = _T(descs[0][7]);
	m_controller = _T(drives[0][0][2]);
	m_cpu = _T(descs[0][3]);
	m_driveletter = _T("C");
	m_driver = _T(drives[0][0][3]);
	m_externalclock = _T(descs[0][5]);
	m_harddisk = _T(drives[0][0][1]);
	m_internalclock = _T(descs[0][4]);
	m_model = _T(descs[0][1]);
	m_os = _T(descs[0][11]);
	m_ramsize = _T(descs[0][8]);
	m_ramspeed = _T(descs[0][10]);
	m_ramtype = _T(descs[0][9]);
	//}}AFX_DATA_INIT
}


void CDescDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDescDlg)
	DDX_Text(pDX, IDC_NOFTHREADS, m_nofthreads);
	DDV_MinMaxInt(pDX, m_nofthreads, 1, 128);
	DDX_Control(pDX, IDC_DELDRIVE, m_deldrive);
	DDX_Control(pDX, IDC_SPIN1, m_spin1);
	DDX_Control(pDX, IDOK, m_ok);
	DDX_Text(pDX, IDC_BOARD, m_board);
	DDV_MaxChars(pDX, m_board, 64);
	DDX_Text(pDX, IDC_BRAND, m_brand);
	DDX_Text(pDX, IDC_CACHESIZE, m_cachesize);
	DDX_Text(pDX, IDC_CACHETYPE, m_cachetype);
	DDX_Text(pDX, IDC_CONTROLLER, m_controller);
	DDX_Text(pDX, IDC_CPU, m_cpu);
	DDX_Text(pDX, IDC_DRIVELETTER, m_driveletter);
	DDX_Text(pDX, IDC_DRIVER, m_driver);
	DDX_Text(pDX, IDC_EXTERNALCLOCK, m_externalclock);
	DDX_Text(pDX, IDC_HARDDISK, m_harddisk);
	DDX_Text(pDX, IDC_INTERNALCLOCK, m_internalclock);
	DDX_Text(pDX, IDC_MODEL, m_model);
	DDX_Text(pDX, IDC_OS, m_os);
	DDX_Text(pDX, IDC_RAMSIZE, m_ramsize);
	DDX_Text(pDX, IDC_RAMSPEED, m_ramspeed);
	DDX_Text(pDX, IDC_RAMTYPE, m_ramtype);
	DDX_Text(pDX, IDC_NOFCPUS, m_nofcpus);
	DDV_MaxChars(pDX, m_nofcpus, 8);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDescDlg, CDialog)
	//{{AFX_MSG_MAP(CDescDlg)
	ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN1, OnDeltaposSpin1)
	ON_EN_CHANGE(IDC_BOARD, OnChangeBoard)
	ON_EN_CHANGE(IDC_BRAND, OnChangeBrand)
	ON_EN_CHANGE(IDC_CACHESIZE, OnChangeCachesize)
	ON_EN_CHANGE(IDC_CACHETYPE, OnChangeCachetype)
	ON_EN_CHANGE(IDC_CONTROLLER, OnChangeController)
	ON_EN_CHANGE(IDC_CPU, OnChangeCpu)
	ON_EN_CHANGE(IDC_DRIVELETTER, OnChangeDriveletter)
	ON_EN_CHANGE(IDC_DRIVER, OnChangeDriver)
	ON_EN_CHANGE(IDC_HARDDISK, OnChangeHarddisk)
	ON_EN_CHANGE(IDC_MODEL, OnChangeModel)
	ON_EN_CHANGE(IDC_OS, OnChangeOs)
	ON_EN_CHANGE(IDC_RAMSIZE, OnChangeRamsize)
	ON_EN_CHANGE(IDC_RAMSPEED, OnChangeRamspeed)
	ON_EN_CHANGE(IDC_RAMTYPE, OnChangeRamtype)
	ON_EN_CHANGE(IDC_EXTERNALCLOCK, OnChangeExternalclock)
	ON_EN_CHANGE(IDC_INTERNALCLOCK, OnChangeInternalclock)
	ON_BN_CLICKED(IDC_DELDRIVE, OnDeldrive)
	ON_EN_CHANGE(IDC_NOFTHREADS, OnChangeNofthreads)
	ON_EN_CHANGE(IDC_NOFCPUS, OnChangeNofcpus)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDescDlg message handlers


void CDescDlg::OnDeltaposSpin1(NMHDR* pNMHDR, LRESULT* pResult) 
{	
	NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
	// TODO: Add your control notification handler code here
	
	UpdateData(TRUE);
	m_spin1.SetRange(67,90);
	/*if (!(drivenumber<0)&&!(drivenumber>24))
	{
		sprintf(drives[0][drivenumber][0],m_driveletter);
		sprintf(drives[0][drivenumber][1],m_harddisk);
		sprintf(drives[0][drivenumber][2],m_controller);
		sprintf(drives[0][drivenumber][3],m_driver);
	}*/
	
	drivenumber=(m_spin1.GetPos()-3)%25;
	m_driveletter=char(drivenumber+67);
	if (drives[0][drivenumber][0][0]==char(drivenumber+67))
	{
		m_harddisk=_T(drives[0][drivenumber][1]);
		m_controller=_T(drives[0][drivenumber][2]);
		m_driver=_T(drives[0][drivenumber][3]);
	}
	else
	{	
		m_harddisk=_T("");
		m_controller=_T("");
		m_driver=_T("");
	}

	UpdateData(FALSE);
	*pResult = 0;
}

void CDescDlg::OnOK() 
{
	// TODO: Add extra validation here
	okay=true;
	UpdateData(TRUE);
	//CMainWindow cmw;
	char buffer[64];
	_itoa(m_nofthreads,buffer,10);
	sprintf(descs[0][12],buffer);
	sprintf(descs[0][13],m_nofcpus);
	sprintf(descs[0][0],m_brand);
	sprintf(descs[0][1],m_model);
	sprintf(descs[0][2],m_board);
	sprintf(descs[0][3],m_cpu);
	sprintf(descs[0][4],m_internalclock);
	sprintf(descs[0][5],m_externalclock);
	sprintf(descs[0][6],m_cachesize);
	sprintf(descs[0][7],m_cachetype);
	sprintf(descs[0][8],m_ramsize);
	sprintf(descs[0][9],m_ramtype);
	sprintf(descs[0][10],m_ramspeed);
	sprintf(descs[0][11],m_os);
	
	CDialog::OnOK();
}

void CDescDlg::OnChangeBoard() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
}

void CDescDlg::OnChangeBrand() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
}

void CDescDlg::OnChangeCachesize() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
}

void CDescDlg::OnChangeCachetype() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	
}

void CDescDlg::OnChangeController() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);

	sprintf(drives[0][drivenumber][0],m_driveletter);
	sprintf(drives[0][drivenumber][2],m_controller);
	
}

void CDescDlg::OnChangeCpu() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	
}

void CDescDlg::OnChangeDriveletter() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
}

void CDescDlg::OnChangeDriver() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	sprintf(drives[0][drivenumber][0],m_driveletter);
	sprintf(drives[0][drivenumber][3],m_driver);
	

}

void CDescDlg::OnChangeHarddisk() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);

	sprintf(drives[0][drivenumber][0],m_driveletter);
	sprintf(drives[0][drivenumber][1],m_harddisk);
	UpdateData(FALSE);

}

void CDescDlg::OnChangeModel() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	
}

void CDescDlg::OnChangeOs() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	
}

void CDescDlg::OnChangeRamsize() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	
}

void CDescDlg::OnChangeRamspeed() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	
}

void CDescDlg::OnChangeRamtype() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	
}

void CDescDlg::OnChangeExternalclock() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	
}

void CDescDlg::OnChangeInternalclock() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	
}

void CDescDlg::OnDeldrive() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	sprintf(drives[0][int(m_driveletter[0])-67][0],"");
	m_harddisk=_T("");
	m_controller=_T("");
	m_driver=_T("");
	UpdateData(FALSE);
}

void CDescDlg::OnChangeNofthreads() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	
}

void CDescDlg::OnChangeNofcpus() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	
}

⌨️ 快捷键说明

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