📄 testform.cpp
字号:
// TestForm.cpp : implementation file
//
#include "stdafx.h"
#include "GUI.h"
#include "TestForm.h"
#include ".\testform.h"
// TestForm
IMPLEMENT_DYNCREATE(TestForm, CFormView)
TestForm::TestForm()
: CFormView(TestForm::IDD)
{
}
TestForm::~TestForm()
{
}
void TestForm::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(TestForm, CFormView)
ON_BN_CLICKED(IDC_BUTTON_TEST, OnBnClickedButtonTest)
END_MESSAGE_MAP()
// TestForm diagnostics
#ifdef _DEBUG
void TestForm::AssertValid() const
{
CFormView::AssertValid();
}
void TestForm::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
// TestForm message handlers
void TestForm::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
SetDlgItemText(IDC_EDIT_CLOCK_COUNT,_T("1000000"));
SetDlgItemText(IDC_COMBO_MODE,_T("MULTI PROCESSOR"));
SetDlgItemText(IDC_EDIT_MISSED_CALS,_T("0"));
}
void TestForm::OnBnClickedButtonTest()
{
CString strClock,strMode;
GetDlgItemText(IDC_EDIT_CLOCK_COUNT,strClock);
GetDlgItemText(IDC_COMBO_MODE,strMode);
WCHAR* pStr = strClock.GetBuffer();
long Clock = _wtol(pStr);
long Mode;
if(strMode == _T("SINGLE PROCESSOR"))
Mode = 0;
else if(strMode == _T("MULTI PROCESSOR"))
Mode = 1;
else
{
AfxMessageBox(_T("Mode undefined\n"));
return;
}
WCHAR in_data[8];
WCHAR ret_data[2];
DWORD BytesReturned;
memcpy((char*)in_data,&Clock,4);
memcpy((char*)in_data+4,&Mode,4);
BOOL res = mDrvWork.Exchange(
_T("\\\\.\\TestDriver"),
IOCTL_DRIVER_TEST,
in_data, // Input string
sizeof(in_data), // Size of input string
ret_data, // Output string
sizeof(ret_data), // Size of buffer for output string
&BytesReturned);
if(!res)
AfxMessageBox(_T("Send error"));
else
{
if(BytesReturned!=4)
{
CString str_error;
str_error.Format(_T("Error %X"),ret_data);
AfxMessageBox(str_error);
return;
}
CString strCalls;
ULONG calls;
memcpy(&calls,ret_data,4);
strCalls.Format(_T("%d"),calls);
SetDlgItemText(IDC_EDIT_MISSED_CALS,strCalls);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -