📄 hfcj001view.cpp
字号:
datacon.chdevno = 0;
JiaoYan.SetEvent();
Sleep(2000); //退出前等待一段时间,让其它线程关闭
//退出时关闭数据库
sLock.Lock();
if(pCuijiaoSet.IsOpen())
pCuijiaoSet.Close();
if(pDatabase.IsOpen())
pDatabase.Close();
sLock.Unlock();
sWritelock.Lock();
if(pWritebase.IsOpen())
pWritebase.Close();
sWritelock.Unlock();
if(KillTimer(CUSTOM_TIMER)==0){
MessageBox(_T("定时器未开启或关闭定时器失败"),_T("错误"),MB_ICONEXCLAMATION||MB_OK);
//exit(1);
}
}
void CHfcj001View::OnUpdateStartzdcj(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
switch(m_IDzdcj){
case ID_STARTZDCJ:
pCmdUI->Enable(pCmdUI->m_nID==ID_ENDZDCJ);
pCmdUI->SetCheck(pCmdUI->m_nID==ID_STARTZDCJ);
break;
case ID_ENDZDCJ:
pCmdUI->Enable(pCmdUI->m_nID!=ID_ENDZDCJ);
pCmdUI->SetCheck(pCmdUI->m_nID==ID_ENDZDCJ);
break;
default:
break;
}
}
void CHfcj001View::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
jmjh();
UpdateData(FALSE);
time_process();
CFormView::OnTimer(nIDEvent);
}
void CHfcj001View::jmjh()
{
int i;
int j=0;
char ls_i[10];
for(i=0;i<MAXDEVS;i++){
if(strcmp(signlight[i].app_id,cjappid)!=0){
continue;
}
j++;
if(j>10) break;
itoa(i+1,ls_i,10);
switch(j){
case 1:
m_endtime1=teleinfo[i].zzsj_time;
m_jieguo1=dxinfo[i].chdevcjjg;
m_money1=teleinfo[i].cuijiao;
m_starttime1=teleinfo[i].qssj_time;
m_sx1.SetWindowText(_T(ls_i));
m_tele1=teleinfo[i].num;
m_zt1=dxinfo[i].chdevztmx;
break;
case 2:
m_endtime2=teleinfo[i].zzsj_time;
m_jieguo2=dxinfo[i].chdevcjjg;
m_money2=teleinfo[i].cuijiao;
m_starttime2=teleinfo[i].qssj_time;
m_sx2.SetWindowText(_T(ls_i));
m_tele2=teleinfo[i].num;
m_zt2=dxinfo[i].chdevztmx;
break;
case 3:
m_endtime3=teleinfo[i].zzsj_time;
m_jieguo3=dxinfo[i].chdevcjjg;
m_money3=teleinfo[i].cuijiao;
m_starttime3=teleinfo[i].qssj_time;
m_sx3.SetWindowText(_T(ls_i));
m_tele3=teleinfo[i].num;
m_zt3=dxinfo[i].chdevztmx;
break;
case 4:
m_endtime4=teleinfo[i].zzsj_time;
m_jieguo4=dxinfo[i].chdevcjjg;
m_money4=teleinfo[i].cuijiao;
m_starttime4=teleinfo[i].qssj_time;
m_sx4.SetWindowText(_T(ls_i));
m_tele4=teleinfo[i].num;
m_zt4=dxinfo[i].chdevztmx;
break;
case 5:
m_endtime5=teleinfo[i].zzsj_time;
m_jieguo5=dxinfo[i].chdevcjjg;
m_money5=teleinfo[i].cuijiao;
m_starttime5=teleinfo[i].qssj_time;
m_sx5.SetWindowText(_T(ls_i));
m_tele5=teleinfo[i].num;
m_zt5=dxinfo[i].chdevztmx;
break;
case 6:
m_endtime6=teleinfo[i].zzsj_time;
m_jieguo6=dxinfo[i].chdevcjjg;
m_money6=teleinfo[i].cuijiao;
m_starttime6=teleinfo[i].qssj_time;
m_sx6.SetWindowText(_T(ls_i));
m_tele6=teleinfo[i].num;
m_zt6=dxinfo[i].chdevztmx;
break;
case 7:
m_endtime7=teleinfo[i].zzsj_time;
m_jieguo7=dxinfo[i].chdevcjjg;
m_money7=teleinfo[i].cuijiao;
m_starttime7=teleinfo[i].qssj_time;
m_sx7.SetWindowText(_T(ls_i));
m_tele7=teleinfo[i].num;
m_zt7=dxinfo[i].chdevztmx;
break;
case 8:
m_endtime8=teleinfo[i].zzsj_time;
m_jieguo8=dxinfo[i].chdevcjjg;
m_money8=teleinfo[i].cuijiao;
m_starttime8=teleinfo[i].qssj_time;
m_sx8.SetWindowText(_T(ls_i));
m_tele8=teleinfo[i].num;
m_zt8=dxinfo[i].chdevztmx;
break;
case 9:
m_endtime9=teleinfo[i].zzsj_time;
m_jieguo9=dxinfo[i].chdevcjjg;
m_money9=teleinfo[i].cuijiao;
m_starttime9=teleinfo[i].qssj_time;
m_sx9.SetWindowText(_T(ls_i));
m_tele9=teleinfo[i].num;
m_zt9=dxinfo[i].chdevztmx;
break;
case 10:
m_endtime10=teleinfo[i].zzsj_time;
m_jieguo10=dxinfo[i].chdevcjjg;
m_money10=teleinfo[i].cuijiao;
m_starttime10=teleinfo[i].qssj_time;
m_sx10.SetWindowText(_T(ls_i));
m_tele10=teleinfo[i].num;
m_zt10=dxinfo[i].chdevztmx;
break;
}
}
GetTime(dqsj_time);
m_currenttime=dqsj_time;
if(dba_connect==DBA_TRUE) //数据库连接状态(DBA_FALSE表示异常,DBA_TRUE表示正常)
m_readdbzt="正常";
else
m_readdbzt="异常";
if(dbawrite_connect==DBA_TRUE)
m_writedbzt="正常";
else
m_writedbzt="异常";
}
void CHfcj001View::OnSetcjarg()
{
// TODO: Add your command handler code here
CWaitCursor wait;
CDialogcjarg cjargDlg;
cjargDlg.DoModal();
}
void CHfcj001View::OnCopyZdcj()
{
m_allcounts=telecount.all_count;
m_rdrecords=telecount.rdrecord_count;
m_successcounts=telecount.success_count;
m_lrecord=lcuijiaocurrent;
UpdateData(FALSE);
}
void CHfcj001View::OnSetcjhth()
{
// TODO: Add your command handler code here
CWaitCursor wait;
CDialoghtharg cjhthDlg;
cjhthDlg.DoModal();
}
void CHfcj001View::OnButtonsx1()
{
// TODO: Add your control notification handler code here
int channel;
CString cstr;
char ls_chan[20];
m_sx1.GetWindowText(cstr);
sprintf(ls_chan,cstr);
channel=atoi(ls_chan)-1;
if((channel>=0)&&(channel<MAXDEVS)){
Reset_chdev(channel);
}
}
void CHfcj001View::OnButtonsx10()
{
// TODO: Add your control notification handler code here
int channel;
CString cstr;
char ls_chan[20];
m_sx10.GetWindowText(cstr);
sprintf(ls_chan,cstr);
channel=atoi(ls_chan)-1;
if((channel>=0)&&(channel<MAXDEVS)){
Reset_chdev(channel);
}
}
void CHfcj001View::OnButtonsx2()
{
// TODO: Add your control notification handler code here
int channel;
CString cstr;
char ls_chan[20];
m_sx2.GetWindowText(cstr);
sprintf(ls_chan,cstr);
channel=atoi(ls_chan)-1;
if((channel>=0)&&(channel<MAXDEVS)){
Reset_chdev(channel);
}
}
void CHfcj001View::OnButtonsx3()
{
// TODO: Add your control notification handler code here
int channel;
CString cstr;
char ls_chan[20];
m_sx3.GetWindowText(cstr);
sprintf(ls_chan,cstr);
channel=atoi(ls_chan)-1;
if((channel>=0)&&(channel<MAXDEVS)){
Reset_chdev(channel);
}
}
void CHfcj001View::OnButtonsx4()
{
// TODO: Add your control notification handler code here
int channel;
CString cstr;
char ls_chan[20];
m_sx4.GetWindowText(cstr);
sprintf(ls_chan,cstr);
channel=atoi(ls_chan)-1;
if((channel>=0)&&(channel<MAXDEVS)){
Reset_chdev(channel);
}
}
void CHfcj001View::OnButtonsx5()
{
// TODO: Add your control notification handler code here
int channel;
CString cstr;
char ls_chan[20];
m_sx5.GetWindowText(cstr);
sprintf(ls_chan,cstr);
channel=atoi(ls_chan)-1;
if((channel>=0)&&(channel<MAXDEVS)){
Reset_chdev(channel);
}
}
void CHfcj001View::OnButtonsx6()
{
// TODO: Add your control notification handler code here
int channel;
CString cstr;
char ls_chan[20];
m_sx6.GetWindowText(cstr);
sprintf(ls_chan,cstr);
channel=atoi(ls_chan)-1;
if((channel>=0)&&(channel<MAXDEVS)){
Reset_chdev(channel);
}
}
void CHfcj001View::OnButtonsx7()
{
// TODO: Add your control notification handler code here
int channel;
CString cstr;
char ls_chan[20];
m_sx7.GetWindowText(cstr);
sprintf(ls_chan,cstr);
channel=atoi(ls_chan)-1;
if((channel>=0)&&(channel<MAXDEVS)){
Reset_chdev(channel);
}
}
void CHfcj001View::OnButtonsx8()
{
// TODO: Add your control notification handler code here
int channel;
CString cstr;
char ls_chan[20];
m_sx8.GetWindowText(cstr);
sprintf(ls_chan,cstr);
channel=atoi(ls_chan)-1;
if((channel>=0)&&(channel<MAXDEVS)){
Reset_chdev(channel);
}
}
void CHfcj001View::OnButtonsx9()
{
// TODO: Add your control notification handler code here
int channel;
CString cstr;
char ls_chan[20];
m_sx9.GetWindowText(cstr);
sprintf(ls_chan,cstr);
channel=atoi(ls_chan)-1;
if((channel>=0)&&(channel<MAXDEVS)){
Reset_chdev(channel);
}
}
void CHfcj001View::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CFormView::OnMouseMove(nFlags, point);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -