1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// 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;
}