📄 setpage3.cpp
字号:
m_chk_setclear_mima=FALSE;
m_chk_setdbnumber=FALSE;
m_chk_setprg_mima=FALSE;
m_chk_dbconst=FALSE;
UpdateData(FALSE);
}
BOOL CSetPage2::OnInitDialog()
{
CPropertyPage::OnInitDialog();
m_spin_num.SetRange(0,12);
// TODO: Add extra initialization here
m_time1.SetFormat(_T("HH:mm"));
m_time2.SetFormat(_T("HH:mm"));
m_time3.SetFormat(_T("HH:mm"));
m_time4.SetFormat(_T("HH:mm"));
m_time5.SetFormat(_T("HH:mm"));
m_time6.SetFormat(_T("HH:mm"));
m_time7.SetFormat(_T("HH:mm"));
m_time8.SetFormat(_T("HH:mm"));
m_time9.SetFormat(_T("HH:mm"));
m_time10.SetFormat(_T("HH:mm"));
m_time11.SetFormat(_T("HH:mm"));
m_time12.SetFormat(_T("HH:mm"));
CTime timeTime(2002, 10, 6, 7, 0, 0);
m_time1.SetTime(&timeTime);
m_time2.SetTime(&timeTime);
m_time3.SetTime(&timeTime);
m_time4.SetTime(&timeTime);
m_time5.SetTime(&timeTime);
m_time6.SetTime(&timeTime);
m_time7.SetTime(&timeTime);
m_time8.SetTime(&timeTime);
m_time9.SetTime(&timeTime);
m_time10.SetTime(&timeTime);
m_time11.SetTime(&timeTime);
m_time12.SetTime(&timeTime);
// m_edit_num=4;
m_combo_fl1.SetCurSel(1);
m_combo_fl2.SetCurSel(2);
/*m_combo_fl3.SetCurSel(2);
m_combo_fl4.SetCurSel(0);
m_combo_fl5.SetCurSel(1);
m_combo_fl6.SetCurSel(2);
m_combo_fl7.SetCurSel(0);
m_combo_fl8.SetCurSel(1);
m_combo_fl9.SetCurSel(2);
m_combo_fl10.SetCurSel(0);
m_combo_fl11.SetCurSel(1);
m_combo_fl12.SetCurSel(2);
*/
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CSetPage2::update()
{
UpdateData();
int fl_count=0;
m_data.Empty();
BYTE ddtemp;
CString temp;
CTime timeTime;
//if(m_edit_num==0)return FALSE;
//////////////////////fl1//////////////////////
ddtemp=(BYTE)m_combo_fl1.GetCurSel();
if(m_combo_fl1.GetCurSel()!=-1&&m_combo_fl1.GetCurSel()!=3)
{
fl_count++;
ddtemp+=0x35;
temp.Format("%02x",ddtemp);
m_data+=temp;
m_time1.GetTime(timeTime);
ddtemp=byte2bcd((BYTE)timeTime.GetMinute())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
ddtemp=byte2bcd((BYTE)timeTime.GetHour())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
}
////////////////////////////////////
//////////////////////fl2//////////////////////
ddtemp=(BYTE)m_combo_fl2.GetCurSel();
if(m_combo_fl2.GetCurSel()!=-1&&m_combo_fl2.GetCurSel()!=3)
{
fl_count++;
ddtemp+=0x35;
temp.Format("%02x",ddtemp);
m_data+=temp;
m_time2.GetTime(timeTime);
ddtemp=byte2bcd((BYTE)timeTime.GetMinute())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
ddtemp=byte2bcd((BYTE)timeTime.GetHour())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
}
////////////////////////////////////
//////////////////////fl3//////////////////////
ddtemp=(BYTE)m_combo_fl3.GetCurSel();
if(m_combo_fl3.GetCurSel()!=-1&&m_combo_fl3.GetCurSel()!=3)
{
fl_count++;
ddtemp+=0x35;
temp.Format("%02x",ddtemp);
m_data+=temp;
m_time3.GetTime(timeTime);
ddtemp=byte2bcd((BYTE)timeTime.GetMinute())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
ddtemp=byte2bcd((BYTE)timeTime.GetHour())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
}
////////////////////////////////////
//////////////////////fl4//////////////////////
ddtemp=(BYTE)m_combo_fl4.GetCurSel();
if(m_combo_fl4.GetCurSel()!=-1&&m_combo_fl4.GetCurSel()!=3)
{
fl_count++;
ddtemp+=0x35;
temp.Format("%02x",ddtemp);
m_data+=temp;
m_time4.GetTime(timeTime);
ddtemp=byte2bcd((BYTE)timeTime.GetMinute())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
ddtemp=byte2bcd((BYTE)timeTime.GetHour())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
}
////////////////////////////////////
//////////////////////fl5//////////////////////
ddtemp=(BYTE)m_combo_fl5.GetCurSel();
if(m_combo_fl5.GetCurSel()!=-1&&m_combo_fl5.GetCurSel()!=3)
{
fl_count++;
ddtemp+=0x35;
temp.Format("%02x",ddtemp);
m_data+=temp;
m_time5.GetTime(timeTime);
ddtemp=byte2bcd((BYTE)timeTime.GetMinute())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
ddtemp=byte2bcd((BYTE)timeTime.GetHour())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
}
////////////////////////////////////
//////////////////////fl6//////////////////////
ddtemp=(BYTE)m_combo_fl6.GetCurSel();
if(m_combo_fl6.GetCurSel()!=-1&&m_combo_fl6.GetCurSel()!=3)
{
fl_count++;
ddtemp+=0x35;
temp.Format("%02x",ddtemp);
m_data+=temp;
m_time6.GetTime(timeTime);
ddtemp=byte2bcd((BYTE)timeTime.GetMinute())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
ddtemp=byte2bcd((BYTE)timeTime.GetHour())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
}
////////////////////////////////////
//////////////////////fl7//////////////////////
ddtemp=(BYTE)m_combo_fl7.GetCurSel();
if(m_combo_fl7.GetCurSel()!=-1&&m_combo_fl7.GetCurSel()!=3)
{
fl_count++;
ddtemp+=0x35;
temp.Format("%02x",ddtemp);
m_data+=temp;
m_time7.GetTime(timeTime);
ddtemp=byte2bcd((BYTE)timeTime.GetMinute())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
ddtemp=byte2bcd((BYTE)timeTime.GetHour())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
}
////////////////////////////////////
//////////////////////fl8//////////////////////
ddtemp=(BYTE)m_combo_fl8.GetCurSel();
if(m_combo_fl8.GetCurSel()!=-1&&m_combo_fl8.GetCurSel()!=3)
{
fl_count++;
ddtemp+=0x35;
temp.Format("%02x",ddtemp);
m_data+=temp;
m_time8.GetTime(timeTime);
ddtemp=byte2bcd((BYTE)timeTime.GetMinute())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
ddtemp=byte2bcd((BYTE)timeTime.GetHour())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
}
////////////////////////////////////
//////////////////////fl9//////////////////////
ddtemp=(BYTE)m_combo_fl9.GetCurSel();
if(m_combo_fl9.GetCurSel()!=-1&&m_combo_fl9.GetCurSel()!=3)
{
fl_count++;
ddtemp+=0x35;
temp.Format("%02x",ddtemp);
m_data+=temp;
m_time9.GetTime(timeTime);
ddtemp=byte2bcd((BYTE)timeTime.GetMinute())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
ddtemp=byte2bcd((BYTE)timeTime.GetHour())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
}
////////////////////////////////////
//////////////////////fl10//////////////////////
ddtemp=(BYTE)m_combo_fl10.GetCurSel();
if(m_combo_fl10.GetCurSel()!=-1&&m_combo_fl10.GetCurSel()!=3)
{
fl_count++;
ddtemp+=0x35;
temp.Format("%02x",ddtemp);
m_data+=temp;
m_time10.GetTime(timeTime);
ddtemp=byte2bcd((BYTE)timeTime.GetMinute())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
ddtemp=byte2bcd((BYTE)timeTime.GetHour())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
}
////////////////////////////////////
//////////////////////fl11//////////////////////
ddtemp=(BYTE)m_combo_fl11.GetCurSel();
if(m_combo_fl11.GetCurSel()!=-1&&m_combo_fl11.GetCurSel()!=3)
{
fl_count++;
ddtemp+=0x35;
temp.Format("%02x",ddtemp);
m_data+=temp;
m_time11.GetTime(timeTime);
ddtemp=byte2bcd((BYTE)timeTime.GetMinute())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
ddtemp=byte2bcd((BYTE)timeTime.GetHour())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
}
////////////////////////////////////
//////////////////////fl4//////////////////////
ddtemp=(BYTE)m_combo_fl12.GetCurSel();
if(m_combo_fl12.GetCurSel()!=-1&&m_combo_fl2.GetCurSel()!=3)
{
fl_count++;
ddtemp+=0x35;
temp.Format("%02x",ddtemp);
m_data+=temp;
m_time12.GetTime(timeTime);
ddtemp=byte2bcd((BYTE)timeTime.GetMinute())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
ddtemp=byte2bcd((BYTE)timeTime.GetHour())+0x33;
temp.Format("%02x",ddtemp);
m_data+=temp;
}
//m_data+="DD";
// AfxMessageBox(m_data);
////////////////////////////////////
if(fl_count<1)
return FALSE;
else
return TRUE;
//AfxMessageBox(m_data);
}
BYTE CSetPage2::byte2bcd(BYTE bytedata)
{
BYTE result;
result=(bytedata/10)*16+bytedata%10;
return result;
}
BOOL CSetPage3::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// TODO: Add extra initialization here
m_spin_ontime.SetRange(0,99);
m_spin_offtime.SetRange(0,99);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSetPage3::OnBtnSelectall()
{
// TODO: Add your control notification handler code here
UpdateData(FALSE);
m_lchk_curalldl=TRUE;
m_lchk_curfdl=TRUE;
m_lchk_curpdl=TRUE;
m_lchk_curgdl=TRUE;
m_lchk_jvnum=TRUE;
m_lchk_disdetect=TRUE;
m_lchk_bnumber=TRUE;
m_lchk_dis_dot=TRUE;
////////////
m_rchk_salldl=TRUE;
m_rchk_sfdl=TRUE;
m_rchk_spdl=TRUE;
m_rchk_sgdl=TRUE;
m_rchk_ssalldl=TRUE;
m_rchk_ssfdl=TRUE;
m_rchk_sspdl=TRUE;
m_rchk_ssgdl=TRUE;
UpdateData(FALSE);
}
void CSetPage3::OnBtnCancleall()
{
// TODO: Add your control notification handler code here
UpdateData(FALSE);
m_lchk_curalldl=FALSE;
m_lchk_curfdl=FALSE;
m_lchk_curpdl=FALSE;
m_lchk_curgdl=FALSE;
m_lchk_jvnum=FALSE;
m_lchk_disdetect=FALSE;
m_lchk_bnumber=FALSE;
m_lchk_dis_dot=FALSE;
////////////
m_rchk_salldl=FALSE;
m_rchk_sfdl=FALSE;
m_rchk_spdl=FALSE;
m_rchk_sgdl=FALSE;
m_rchk_ssalldl=FALSE;
m_rchk_ssfdl=FALSE;
m_rchk_sspdl=FALSE;
m_rchk_ssgdl=FALSE;
UpdateData(FALSE);
}
BOOL CSetPage3::update()
{
BYTE m_lbyte=0,m_rbyte=0;
UpdateData();
/////////////left///////////////
if(m_lchk_curalldl)
m_lbyte|=0x01;
if(m_lchk_curfdl)
m_lbyte|=0x02;
if(m_lchk_curpdl)
m_lbyte|=0x04;
if(m_lchk_curgdl)
m_lbyte|=0x08;
if(m_lchk_jvnum)
m_lbyte|=0x10;
if(m_lchk_disdetect)
m_lbyte|=0x20;
if(m_lchk_bnumber)
m_lbyte|=0x40;
if(m_lchk_dis_dot)
m_lbyte|=0x80;
/////////////////////////
/////////////left///////////////
if(m_rchk_salldl)
m_rbyte|=0x01;
if(m_rchk_sfdl)
m_rbyte|=0x02;
if(m_rchk_spdl)
m_rbyte|=0x04;
if(m_rchk_sgdl)
m_rbyte|=0x08;
if(m_rchk_ssalldl)
m_rbyte|=0x10;
if(m_rchk_ssfdl)
m_rbyte|=0x20;
if(m_rchk_sspdl)
m_rbyte|=0x40;
if(m_rchk_ssgdl)
m_rbyte|=0x80;
/////////////////////////
if(m_lbyte==0&&m_rbyte==0)return FALSE;
m_lbyte+=0x33;
m_rbyte+=0x33;
CString temp;
temp.Format("%02x%02x",byte2bcd(m_edt_ontime)+0x33,m_rbyte);
m_data.Empty();
m_data+=temp;
temp.Format("%02x%02x",m_lbyte,byte2bcd(m_edt_offtime)+0x33);
m_data+=temp;
// AfxMessageBox(m_data);
return TRUE;
}
BYTE CSetPage3::byte2bcd(BYTE bytedata)
{
BYTE result;
result=(bytedata/10)*16+bytedata%10;
return result;
}
void CSetPage1::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(nIDEvent==1)
{
}
CPropertyPage::OnTimer(nIDEvent);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -