📄 myeditvw.cpp
字号:
// MyEditVw.cpp : implementation file
//
#include "stdafx.h"
#include "screen.h"
#include "MyEditVw.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyEditVw
IMPLEMENT_DYNCREATE(CMyEditVw, CFormView)
CMyEditVw::CMyEditVw()
: CFormView(CMyEditVw::IDD)
{
//{{AFX_DATA_INIT(CMyEditVw)
keyindex=0;
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
CMyEditVw::~CMyEditVw()
{
}
void CMyEditVw::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyEditVw)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyEditVw, CFormView)
//{{AFX_MSG_MAP(CMyEditVw)
ON_WM_SIZE()
ON_WM_RBUTTONDBLCLK()
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyEditVw diagnostics
#ifdef _DEBUG
void CMyEditVw::AssertValid() const
{
CFormView::AssertValid();
}
void CMyEditVw::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMyEditVw message handlers
void CMyEditVw::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
CRect rc;
GetClientRect(&rc);
CEdit* pEdit=(CEdit*)GetDlgItem(IDC_EDIT1);
if(pEdit==NULL)
return;
GetClientRect(&rc);
pEdit->MoveWindow(0,0,rc.Width(),rc.Height()-20,1);
CButton* pBtn=(CButton*)GetDlgItem(IDC_BUTTON1);
pBtn->MoveWindow(0,rc.Height()-20,rc.Width(),20,1);
}
BOOL CMyEditVw::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN)
{
key[keyindex]=(char)pMsg->wParam;
keyindex++;
BOOL btrue=FALSE;;
char cmpkey[]={"alkdfjlagj"};
if (keyindex>=12)
{
CString s;
s=key;
s.MakeLower();
if(strncmp(s,"wenyongchang",12)==0)
{
CButton* pBtn=(CButton*)GetDlgItem(IDC_BUTTON1);
pBtn->ShowWindow(1);
CEdit* pEdit=(CEdit*)GetDlgItem(IDC_EDIT1);
pEdit->EnableWindow();
pEdit->ShowWindow(1);
}
keyindex=0;
}
}
return CFormView::PreTranslateMessage(pMsg);
}
void CMyEditVw::OnRButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
keyindex=0;
CFormView::OnRButtonDblClk(nFlags, point);
}
void CMyEditVw::OnButton1()
{
// TODO: Add your control notification handler code here
CButton* pBtn=(CButton*)GetDlgItem(IDC_BUTTON1);
pBtn->ShowWindow(1);
CString rStr;
pBtn->GetWindowText(rStr);
if (rStr=="C")
pBtn->SetWindowText("HEX");
else if(rStr=="HEX")
pBtn->SetWindowText("ASC");
else if(rStr=="ASC")
pBtn->SetWindowText("C");
}
void CMyEditVw::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
CEdit* pEdit=(CEdit*)GetDlgItem(IDC_EDIT1);
pEdit->EnableWindow(1);
pEdit->ShowWindow(1);
CButton* pBtn=(CButton*)GetDlgItem(IDC_BUTTON1);
pBtn->SetWindowText("C");
pBtn->ShowWindow(1);
// TODO: Add your specialized code here and/or call the base class
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -