⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 softkeydlg.cpp

📁 《面向对象程序设计实用教程》一书的源码
💻 CPP
字号:
// SoftKeyDlg.cpp : implementation file
//

#include "stdafx.h"
#include "cge.h"
#include "cgeDoc.h"
#include "SoftKeyDlg.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSoftKeyDlg dialog


CSoftKeyDlg::CSoftKeyDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSoftKeyDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSoftKeyDlg)
	SaveKey = true;
	//}}AFX_DATA_INIT
}


void CSoftKeyDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSoftKeyDlg)
	DDX_Text(pDX, IDC_EDIT1, m_filename);
//	SaveKey=true;
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSoftKeyDlg, CDialog)
	//{{AFX_MSG_MAP(CSoftKeyDlg)
	ON_BN_CLICKED(IDC_OK, OnOk)
	ON_BN_CLICKED(IDC_DEL, OnDel)
	ON_BN_CLICKED(IDC_BUTTONA, OnButtona)
	ON_BN_CLICKED(IDC_BUTTONB, OnButtonb)
	ON_BN_CLICKED(IDC_BUTTONC, OnButtonc)
	ON_BN_CLICKED(IDC_BUTTOND, OnButtond)
	ON_BN_CLICKED(IDC_BUTTONE, OnButtone)
	ON_BN_CLICKED(IDC_BUTTONF, OnButtonf)
	ON_BN_CLICKED(IDC_BUTTONG, OnButtong)
	ON_BN_CLICKED(IDC_BUTTONH, OnButtonh)
	ON_BN_CLICKED(IDC_BUTTONI, OnButtoni)
	ON_BN_CLICKED(IDC_BUTTONJ, OnButtonj)
	ON_BN_CLICKED(IDC_BUTTONK, OnButtonk)
	ON_BN_CLICKED(IDC_BUTTONL, OnButtonl)
	ON_BN_CLICKED(IDC_BUTTONM, OnButtonm)
	ON_BN_CLICKED(IDC_BUTTONN, OnButtonn)
	ON_BN_CLICKED(IDC_BUTTONO, OnButtono)
	ON_BN_CLICKED(IDC_BUTTONP, OnButtonp)
	ON_BN_CLICKED(IDC_BUTTONQ, OnButtonq)
	ON_BN_CLICKED(IDC_BUTTONR, OnButtonr)
	ON_BN_CLICKED(IDC_BUTTONS, OnButtons)
	ON_BN_CLICKED(IDC_BUTTONT, OnButtont)
	ON_BN_CLICKED(IDC_BUTTONU, OnButtonu)
	ON_BN_CLICKED(IDC_BUTTONV, OnButtonv)
	ON_BN_CLICKED(IDC_BUTTONW, OnButtonw)
	ON_BN_CLICKED(IDC_BUTTONX, OnButtonx)
	ON_BN_CLICKED(IDC_BUTTONY, OnButtony)
	ON_BN_CLICKED(IDC_BUTTONZ, OnButtonz)
	ON_BN_CLICKED(IDC_BUTTON0, OnButton0)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
	ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
	ON_BN_CLICKED(IDC_BUTTON6, OnButton6)
	ON_BN_CLICKED(IDC_BUTTON7, OnButton7)
	ON_BN_CLICKED(IDC_BUTTON8, OnButton8)
	ON_BN_CLICKED(IDC_BUTTON9, OnButton9)
	ON_WM_CREATE()
	ON_WM_CLOSE()
	ON_WM_CANCELMODE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSoftKeyDlg message handlers

void CSoftKeyDlg::OnOk() 
{
	// TODO: Add your control notification handler code here
	UpdateData(true);
	SaveKey=true;
	if (m_filename == "")
		m_filename = _T("DEC") + CTime::GetCurrentTime().Format("%y%m%d");
	CDialog::OnOK();//利用这个技术可以在系统的消息方法前
	//或后面增加程序员自己的操作

	
}


void CSoftKeyDlg::OnDel() 
{
	// TODO: Add your control notification handler code here
	m_filename = _T("");
	UpdateData(false);

}

void CSoftKeyDlg::OnButtona() 
{
	// TODO: Add your control notification handler code here
	m_filename += "A";
	UpdateData(false);
}

void CSoftKeyDlg::OnButtonb() 
{
	// TODO: Add your control notification handler code here
	m_filename += "B";
	UpdateData(false);
}

void CSoftKeyDlg::OnButtonc() 
{
	// TODO: Add your control notification handler code here
	m_filename += "C";
	UpdateData(false);
}

void CSoftKeyDlg::OnButtond() 
{
	// TODO: Add your control notification handler code here
	m_filename += "D";
	UpdateData(false);
}

void CSoftKeyDlg::OnButtone() 
{
	// TODO: Add your control notification handler code here
	m_filename += "E";
	UpdateData(false);
}

void CSoftKeyDlg::OnButtonf() 
{
	// TODO: Add your control notification handler code here
	m_filename += "F";
	UpdateData(false);
}

void CSoftKeyDlg::OnButtong() 
{
	// TODO: Add your control notification handler code here
	m_filename += "G";
	UpdateData(false);
}

void CSoftKeyDlg::OnButtonh() 
{
	// TODO: Add your control notification handler code here
	m_filename += "H";
	UpdateData(false);
}

void CSoftKeyDlg::OnButtoni() 
{
	// TODO: Add your control notification handler code here
	m_filename += "I";
	UpdateData(false);
}

void CSoftKeyDlg::OnButtonj() 
{
	// TODO: Add your control notification handler code here
	m_filename += "J";
	UpdateData(false);
}

void CSoftKeyDlg::OnButtonk() 
{
	// TODO: Add your control notification handler code here
	m_filename += "K";
	UpdateData(false);
}

void CSoftKeyDlg::OnButtonl() 
{
    m_filename += "L";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButtonm() 
{
    m_filename += "M";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButtonn() 
{
    m_filename += "N";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButtono() 
{
    m_filename += "O";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButtonp() 
{
    m_filename += "P";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButtonq() 
{
    m_filename += "Q";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButtonr() 
{
    m_filename += "R";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButtons() 
{
    m_filename += "S";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButtont() 
{
    m_filename += "T";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButtonu() 
{
    m_filename += "U";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButtonv() 
{
    m_filename += "V";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButtonw() 
{
    m_filename += "W";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButtonx() 
{
    m_filename += "X";
	UpdateData(false);	
	
}

void CSoftKeyDlg::OnButtony() 
{
    m_filename += "Y";
	UpdateData(false);	
	
}

void CSoftKeyDlg::OnButtonz() 
{
    m_filename += "Z";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButton0() 
{
    m_filename += "0";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButton1() 
{
    m_filename += "1";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButton2() 
{
    m_filename += "2";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButton3() 
{
    m_filename += "3";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButton4() 
{
    m_filename += "4";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButton5() 
{
    m_filename += "5";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButton6() 
{
    m_filename += "6";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButton7() 
{
    m_filename += "7";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButton8() 
{
    m_filename += "8";
	UpdateData(false);	
}

void CSoftKeyDlg::OnButton9() 
{
    m_filename += "9";
	UpdateData(false);	
}

BOOL CSoftKeyDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	/*	
	m_filename = _T("DEC") + CTime::GetCurrentTime().Format("%y%m%d");
	UpdateData(false);//对话框已经创建完,所以要发送一下
    */
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

int CSoftKeyDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
	m_filename = _T("DEC") + CTime::GetCurrentTime().Format("%y%m%d");
	return 0;
}

void CSoftKeyDlg::OnClose() 
{
	SaveKey =false;	
	CDialog::OnClose();
}

void CSoftKeyDlg::OnCancelMode() 
{

   SaveKey =false;
	
	CDialog::OnCancelMode();
	
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -