source: trunk/KeyComboDlg.cpp @ 29

Revision 29, 2.8 KB checked in by lowjoel, 7 years ago (diff)

-Silenced more unused variable warnings
-Standardize the header at the top of every source file

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1// KeyComboDlg.cpp
2// $Id$
3//
4// Eraser. Secure data removal. For Windows.
5// Copyright © 1997-2001  Sami Tolvanen (sami@tolvanen.com).
6// Copyright © 2001-2006  Garrett Trant (support@heidi.ie).
7// Copyright © 2007 The Eraser Project
8//
9// This program is free software; you can redistribute it and/or
10// modify it under the terms of the GNU General Public License
11// as published by the Free Software Foundation; either version 2
12// of the License, or (at your option) any later version.
13//
14// This program is distributed in the hope that it will be useful,
15// but WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17// GNU General Public License for more details.
18//
19// You should have received a copy of the GNU General Public License
20// along with this program; if not, write to the Free Software
21// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22// 02111-1307, USA.
23
24#include "stdafx.h"
25#include "Eraser.h"
26#include "KeyComboDlg.h"
27#include <shared/key.h>
28
29
30const LPCTSTR szAccelerKey = "Acceler";
31// CKeyComboDlg dialog
32
33IMPLEMENT_DYNAMIC(CKeyComboDlg, CDialog)
34CKeyComboDlg::CKeyComboDlg(CString wValue /* ="" */, CString strValName /* ="" */, CWnd* pParent /*=NULL*/)
35: CDialog(CKeyComboDlg::IDD, pParent), m_strValue(wValue),m_strRegKey(strValName)
36{
37}
38
39CKeyComboDlg::~CKeyComboDlg()
40{
41}
42
43void CKeyComboDlg::DoDataExchange(CDataExchange* pDX)
44{
45    CDialog::DoDataExchange(pDX);
46    DDX_Control(pDX, IDC_EDITTMP, m_eKey);
47}
48
49
50BEGIN_MESSAGE_MAP(CKeyComboDlg, CDialog)
51    ON_BN_CLICKED(IDOK, OnBnClickedOk)
52    ON_WM_ACTIVATE()
53    ON_EN_CHANGE(IDC_EDITTMP, OnEnChangeEdittmp)
54END_MESSAGE_MAP()
55
56
57// CKeyComboDlg message handlers
58
59BOOL CKeyComboDlg::OnInitDialog()
60{
61    CDialog::OnInitDialog();
62
63    m_eKey.SetLimitText(1);
64    m_eKey.SetWindowText(m_strValue);
65
66    // TODO:  Add extra initialization here
67
68    return TRUE;  // return TRUE unless you set the focus to a control
69    // EXCEPTION: OCX Property Pages should return FALSE
70}
71
72void CKeyComboDlg::OnBnClickedOk()
73{
74    char ch[10];   
75    m_eKey.GetLine(0,ch,1);
76    m_strValue = ch;
77    OnOK();
78}
79
80void CKeyComboDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
81{
82    CDialog::OnActivate(nState, pWndOther, bMinimized);
83    m_eKey.SetFocus();
84    // TODO: Add your message handler code here
85}
86
87
88void CKeyComboDlg::OnEnChangeEdittmp()
89{
90    // TODO:  If this is a RICHEDIT control, the control will not
91    // send this notification unless you override the CDialog::OnInitDialog()
92    // function and call CRichEditCtrl().SetEventMask()
93    // with the ENM_CHANGE flag ORed into the mask.
94
95    // TODO:  Add your control notification handler code here
96    //char cLine[10];
97    char ch[10];
98    m_eKey.GetLine(0,ch,1);
99    CString strLine(ch);
100    if (!strLine.IsEmpty())
101    {
102        CString strTmp(m_strRegKey.MakeUpper());
103        strLine.MakeUpper();
104        if (strTmp.Find(strLine[0]) ==-1 ) {
105            m_eKey.Undo();
106            m_eKey.SetWindowText("");
107        }
108    }
109
110}
Note: See TracBrowser for help on using the repository browser.