📄 set0dlg.cpp
字号:
// Set0Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "ExpansionValveController.h"
#include "Set0Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSet0Dlg dialog
CSet0Dlg::CSet0Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CSet0Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSet0Dlg)
m_steps = 50;
//}}AFX_DATA_INIT
}
CSet0Dlg::CSet0Dlg(HANDLE com, CWnd* pParent /*=NULL*/)
: CDialog(CSet0Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSet0Dlg)
m_steps = 0;
//}}AFX_DATA_INIT
m_com = com;
if (!EscapeCommFunction(m_com, CLRDTR)) {
MessageBox("set direction error!");
return;
}
}
void CSet0Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSet0Dlg)
DDX_Text(pDX, IDC_EDIT1, m_steps);
DDV_MinMaxInt(pDX, m_steps, 0, 1000);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSet0Dlg, CDialog)
//{{AFX_MSG_MAP(CSet0Dlg)
ON_BN_CLICKED(IDC_BUTTON1, OnSteps)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSet0Dlg message handlers
void CSet0Dlg::OnSteps()
{
// TODO: Add your control notification handler code here
if (!UpdateData(TRUE))
return;
char *buf = new char[1024];
std::fill_n(buf, 1024, 0x0F);
unsigned long wl = 0;
if (!WriteFile(m_com, (LPCVOID)buf, m_steps, &wl, NULL)) {
MessageBox("step error!");
return;
}
CString tmp;
tmp.Format("done, go %d steps.", wl);
MessageBox(tmp);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -