// LockSetDlg.cpp : ʵÏÖÎļþ // #include "stdafx.h" #include "BlVisionPro.h" #include "LockSetDlg.h" #include "afxdialogex.h" #define TIMER_ID_LOCK_ID 6001 // CLockSetDlg ¶Ô»°¿ò IMPLEMENT_DYNAMIC(CLockSetDlg, CDialogEx) CLockSetDlg::CLockSetDlg(CWnd* pParent /*=NULL*/) : CDialogEx(IDD_DIALOG_LOCK_SET, pParent) { } CLockSetDlg::~CLockSetDlg() { } void CLockSetDlg::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CLockSetDlg, CDialogEx) ON_WM_CLOSE() ON_WM_TIMER() END_MESSAGE_MAP() // CLockSetDlg ÏûÏ¢´¦Àí³ÌÐò BOOL CLockSetDlg::PreTranslateMessage(MSG* pMsg) { // TODO: ÔÚ´ËÌí¼ÓרÓôúÂëºÍ/»òµ÷ÓûùÀà if (pMsg->message == WM_KEYDOWN) { if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { return TRUE; } } return CDialogEx::PreTranslateMessage(pMsg); } BOOL CLockSetDlg::OnInitDialog() { CDialogEx::OnInitDialog(); m_nLockTime = 0; // TODO: ÔÚ´ËÌí¼Ó¶îÍâµÄ³õʼ»¯ this->SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); SetTimer(TIMER_ID_LOCK_ID, 1000, NULL); return TRUE; // return TRUE unless you set the focus to a control // Òì³£: OCX ÊôÐÔÒ³Ó¦·µ»Ø FALSE } void CLockSetDlg::OnClose() { // TODO: ÔÚ´ËÌí¼ÓÏûÏ¢´¦Àí³ÌÐò´úÂëºÍ/»òµ÷ÓÃĬÈÏÖµ KillTimer(TIMER_ID_LOCK_ID); CDialogEx::OnClose(); } void CLockSetDlg::OnTimer(UINT_PTR nIDEvent) { // TODO: ÔÚ´ËÌí¼ÓÏûÏ¢´¦Àí³ÌÐò´úÂëºÍ/»òµ÷ÓÃĬÈÏÖµ switch (nIDEvent) { case TIMER_ID_LOCK_ID: ShowLockTime(); break; default: break; } CDialogEx::OnTimer(nIDEvent); } void CLockSetDlg::ShowLockTime(void) { /* code */ CString strTime; strTime.Format(_T("Lock: %d sec"), m_nLockTime); GetDlgItem(IDC_STATIC_LOCK_TIME)->SetWindowText(strTime); m_nLockTime += 1; }