📄 watchdogbyllview.cpp
字号:
// WatchDogByllView.cpp : implementation of the CWatchDogByllView class
//
#include "stdafx.h"
#include "WatchDogByll.h"
#include <time.h>
#include "WatchDogByllDoc.h"
#include "WatchDogByllView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWatchDogByllView
IMPLEMENT_DYNCREATE(CWatchDogByllView, CView)
BEGIN_MESSAGE_MAP(CWatchDogByllView, CView)
//{{AFX_MSG_MAP(CWatchDogByllView)
ON_WM_SHOWWINDOW()
ON_WM_TIMER()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWatchDogByllView construction/destruction
CWatchDogByllView::CWatchDogByllView()
{
// TODO: add construction code here
InitParam();
}
CWatchDogByllView::~CWatchDogByllView()
{
}
BOOL CWatchDogByllView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CWatchDogByllView drawing
void CWatchDogByllView::OnDraw(CDC* pDC)
{
CWatchDogByllDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CWatchDogByllView printing
BOOL CWatchDogByllView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CWatchDogByllView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CWatchDogByllView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CWatchDogByllView diagnostics
#ifdef _DEBUG
void CWatchDogByllView::AssertValid() const
{
CView::AssertValid();
}
void CWatchDogByllView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CWatchDogByllDoc* CWatchDogByllView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CWatchDogByllDoc)));
return (CWatchDogByllDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CWatchDogByllView message handlers
void CWatchDogByllView::OnShowWindow(BOOL bShow, UINT nStatus)
{
CView::OnShowWindow(bShow, nStatus);
// TODO: Add your message handler code here
SetTimer(0,1000,NULL);
}
void CWatchDogByllView::OnDestroy()
{
CView::OnDestroy();
// TODO: Add your message handler code here
KillTimer(0);
}
void CWatchDogByllView::InitParam()
{
timeCount=60;
dayCount1=1;
//获取设置
char ccss[3];ccss[1]='\0';ccss[2]='\0';
GetPrivateProfileString("MAIN_CONF","INTERVALDAY","1D",
ccss,sizeof(ccss),".\\CONFIGURE.ini");
if(ccss[0]=='0')
{
CheckEveryday=false;
}
else if(ccss[1]='D')
{
ccss[1]='\0';
dayCount=atoi(ccss);
CheckEveryday=true;
}
else if(ccss[2]='D')
{
ccss[2]='\0';
dayCount=atoi(ccss);
CheckEveryday=true;
}
//获取设置
int dd=0;
char setTime[10];
memset(setTime,0x00,sizeof(setTime));
GetPrivateProfileString("MAIN_CONF","SETTIME","00:00:00",
setTime,sizeof(setTime),".\\CONFIGURE.ini");
if(CheckEveryday)
{
ccss[0]=setTime[0+dd];
ccss[1]=setTime[1+dd];
time_hh=atoi(ccss);
dd+=3;
}
ccss[0]=setTime[0+dd];
ccss[1]=setTime[1+dd];
time_mm=atoi(ccss);
ccss[0]=setTime[3+dd];
ccss[1]=setTime[4+dd];
time_ss=atoi(ccss);
}
void CWatchDogByllView::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(timeCount++>59)
{
time_t lt;
struct tm *tm;
lt=time(NULL);
tm=localtime(<);
bool checkFlag=false;
if(CheckEveryday)
{
if(tm->tm_hour==time_hh && tm->tm_min==time_mm && tm->tm_sec==time_ss)
{
if(dayCount1++==dayCount)
{
dayCount1=1;
checkFlag=true;
}
}
}
else
{
if(tm->tm_min==time_mm && tm->tm_sec==time_ss)
checkFlag=true;
}
if(checkFlag)
{
timeCount=0;
if(syscon.KillOrSearchProc(false))
syscon.KillOrSearchProc(true);
syscon.RunYourExe();
}
if(timeCount>0xEFFF) timeCount=60;
}
CView::OnTimer(nIDEvent);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -