📄 dlgconfig.cpp
字号:
// DlgConfig.cpp : implementation file
//
#include "stdafx.h"
#include "capture.h"
#include "DlgConfig.h"
#include "CaptureDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgConfig dialog
CDlgConfig::CDlgConfig(CWnd* pParent /*=NULL*/)
: CDialog(CDlgConfig::IDD, pParent)
{
m_pParent = pParent;
//{{AFX_DATA_INIT(CDlgConfig)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CDlgConfig::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LIGHT_NORMAL, m_LightNormal);
DDX_Control(pDX, IDC_FOUCE_NORMAL, m_FouceNormal);
DDX_Control(pDX, IDC_DECODE, m_Continuous);
DDX_Control(pDX, IDC_BUZZ, m_Buzz);
//{{AFX_DATA_MAP(CDlgConfig)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgConfig, CDialog)
//{{AFX_MSG_MAP(CDlgConfig)
ON_BN_CLICKED(IDC_LIGHT_NORMAL, OnLightNormal)
ON_BN_CLICKED(IDC_LIGHT_ON, OnLightOn)
ON_BN_CLICKED(IDC_LIGHT_OFF, OnLightOff)
ON_BN_CLICKED(IDC_FOUCE_NORMAL, OnFouceNormal)
ON_BN_CLICKED(IDC_FOUCE_ON, OnFouceOn)
ON_BN_CLICKED(IDC_FOUCE_OFF, OnFouceOff)
ON_BN_CLICKED(IDC_DECODE, OnDecode)
ON_BN_CLICKED(IDC_BUZZ, OnBuzz)
ON_EN_CHANGE(IDC_SPACE, OnChangeSpace)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgConfig message handlers
BOOL CDlgConfig::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_Buzz.SetCheck(1);
m_LightNormal.SetCheck(1);
m_FouceNormal.SetCheck(1);
GetDlgItem(IDC_SPACE)->EnableWindow(FALSE);
SetDlgItemText(IDC_SPACE, _T("1000"));
g_Space = 1000;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDlgConfig::OnLightNormal()
{
// TODO: Add your control notification handler code here
g_LightState = NORMAL;
CaptureLight(0, 0);
}
void CDlgConfig::OnLightOn()
{
// TODO: Add your control notification handler code here
g_LightState = ALWAYSON;
CaptureLight(0, 0);
}
void CDlgConfig::OnLightOff()
{
// TODO: Add your control notification handler code here
g_LightState = ALWAYSOFF;
CaptureLight(0, 0);
}
void CDlgConfig::OnFouceNormal()
{
// TODO: Add your control notification handler code here
g_FouceState = NORMAL;
CaptureLight(0, 0);
}
void CDlgConfig::OnFouceOn()
{
// TODO: Add your control notification handler code here
g_FouceState = ALWAYSON;
CaptureLight(0, 0);
}
void CDlgConfig::OnFouceOff()
{
// TODO: Add your control notification handler code here
g_FouceState = ALWAYSOFF;
CaptureLight(0, 0);
}
void CDlgConfig::OnDecode()
{
// TODO: Add your control notification handler code here
if(g_IsContinuous == FALSE)
{
g_IsContinuous = TRUE;
GetDlgItem(IDC_SPACE)->EnableWindow();
}
else
{
g_IsContinuous = FALSE;
GetDlgItem(IDC_SPACE)->EnableWindow(FALSE);
}
// ((CCaptureDlg *)m_pParent)->m_IsContinuous = IsContinous;
}
void CDlgConfig::OnBuzz()
{
// TODO: Add your control notification handler code here
if(g_BuzzState == TRUE)
{
g_BuzzState = FALSE;
}
else
{
g_BuzzState = TRUE;
}
}
void char2int(char * c, int *i)
{
int Count;
int Len;
int temp = 0;
Len = strlen(c);
for(Count = 0; Count < Len; Count++)
{
if ((c[Count]<='9') && (c[Count]>='0'))
{
temp = temp * 10 + c[Count] - '0';
}
}
*i = temp;
}
void CDlgConfig::OnChangeSpace()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
char Space[128];
char ASCII[128];
CString Temp;
memset(Space, 0, sizeof(Space));
memset(ASCII, 0, sizeof(ASCII));
GetDlgItemTextW(this->m_hWnd, IDC_SPACE, (LPWSTR)Space, 127);
Temp.Format(_T("%s"), Space);
WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR, (LPCWSTR)Space, Temp.GetLength(), (LPSTR)ASCII, 128, 0,0);
char2int(ASCII, &g_Space);
// TODO: Add your control notification handler code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -