📄 prgdlg0.cpp
字号:
// PrgDlg0.cpp : implementation file
//
#include "stdafx.h"
#include "prgx.h"
#include "PrgDlg0.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPrgDlg0 dialog
CPrgDlg0::CPrgDlg0(CWnd* pParent /*=NULL*/)
: CDialog(CPrgDlg0::IDD, pParent)
{
//{{AFX_DATA_INIT(CPrgDlg0)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CPrgDlg0::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPrgDlg0)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPrgDlg0, CDialog)
//{{AFX_MSG_MAP(CPrgDlg0)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPrgDlg0 message handlers
BOOL CPrgDlg0::OnInitDialog()
{
CDialog::OnInitDialog();
// char s[100];
x0=(CButton *)GetDlgItem(IDOK);
x0->EnableWindow(FALSE);
SetTimer(22222,50,NULL);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPrgDlg0::OnTimer(UINT nIDEvent)
{
KillTimer(nIDEvent);
CDialog::OnTimer(nIDEvent);
if(flag)r=prg->InitComm232();
else r=0;
if(!r)
{
ReTry: if((r=prg->Comm_Test(0)))
{if(AfxMessageBox(" 串口通讯操作失败!",MB_RETRYCANCEL)==IDRETRY)
{ Sleep(500);
goto ReTry;
}
}
// SetDlgItemText(IDC_STATIC0,"通讯串口初始化错误!");
}
if(r)SetDlgItemText(IDC_STATIC0," 通讯失败!");
else SetDlgItemText(IDC_STATIC0," 通讯成功!");
x0->EnableWindow(TRUE);
x0->SetFocus();
UpdateData(FALSE);
}
void CPrgDlg0::OnOK()
{
if(r)CDialog::OnCancel();
else CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -