📄 dlgmachine.cpp
字号:
// DlgMachine.cpp : implementation file
//
#include "stdafx.h"
#include "videocapture.h"
#include "DlgMachine.h"
#include "VideoCaptureView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgMachine dialog
CDlgMachine::CDlgMachine(CWnd* pParent /*=NULL*/)
: CDialog(CDlgMachine::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgMachine)
m_name = _T("");
m_code = _T("");
//}}AFX_DATA_INIT
}
void CDlgMachine::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgMachine)
DDX_Text(pDX, IDC_EDIT1, m_name);
DDV_MaxChars(pDX, m_name, 2);
DDX_Text(pDX, IDC_EDIT2, m_code);
DDV_MaxChars(pDX, m_code, 6);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgMachine, CDialog)
//{{AFX_MSG_MAP(CDlgMachine)
ON_WM_SHOWWINDOW()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgMachine message handlers
BOOL CDlgMachine::OnInitDialog()
{
CDialog::OnInitDialog();
/*
TCHAR str[30];
::GetPrivateProfileString("SYS","NAME","--",str,3,".\\Sys.ini");
m_name=str;
::GetPrivateProfileString("SYS","CODE","------",str,7,".\\Sys.ini");
m_code=str;
UpdateData(FALSE);
*/
CVideoCaptureView* pView=CVideoCaptureView::GetView();
while(!pView)
pView=CVideoCaptureView::GetView();
m_name=pView->m_szMachineID;
m_code=pView->m_szAddress;
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDlgMachine::OnOK()
{
UpdateData();
if(m_name.GetLength()!=2)
{
GetDlgItem(IDC_EDIT1)->SetFocus();
MessageBox("机器编号长度必须为2位");
return;
}
if(m_code.GetLength()!=6)
{
GetDlgItem(IDC_EDIT2)->SetFocus();
MessageBox("区域代码长度必须为6位");
return;
}
CVideoCaptureView* pView=CVideoCaptureView::GetView();
while(!pView)
pView=CVideoCaptureView::GetView();
//m_szAddress,m_szMachineID,
pView->m_szAddress=m_code;
pView->m_szMachineID=m_name;
WritePrivateProfileString("SYS","NAME",m_name,".\\Sys.ini");
WritePrivateProfileString("SYS","CODE",m_code,".\\Sys.ini");
CDialog::OnOK();
}
void CDlgMachine::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
CVideoCaptureView* pView=CVideoCaptureView::GetView();
if(pView)
pView->IsCapturing=TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -