chapter2_3dlg.cpp

来自「WinCE开发技巧与实例的配套源码(chapter2)」· C++ 代码 · 共 87 行

CPP
87
字号
// chapter2_3Dlg.cpp : implementation file
//

#include "stdafx.h"
#include "chapter2_3.h"
#include "chapter2_3Dlg.h"
#include "STUtil.h"

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

/////////////////////////////////////////////////////////////////////////////
// CChapter2_3Dlg dialog

CChapter2_3Dlg::CChapter2_3Dlg(CWnd* pParent /*=NULL*/)
	: CDialog(CChapter2_3Dlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CChapter2_3Dlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CChapter2_3Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CChapter2_3Dlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CChapter2_3Dlg, CDialog)
	//{{AFX_MSG_MAP(CChapter2_3Dlg)
	ON_WM_CLOSE()
	ON_WM_KEYUP()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChapter2_3Dlg message handlers

BOOL CChapter2_3Dlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	CenterWindow(GetDesktopWindow());	// center to the hpc screen


	CSTUtil su;
	for (int i=0xc1; i<=0xcf; i++) {
		su.RegisterHotKey(m_hWnd, i, i);
	}
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}



void CChapter2_3Dlg::OnClose() 
{
	for (int i=0xc1; i<=0xcf; i++) {
		UnregisterHotKey(m_hWnd, i);
	}
	
	CDialog::OnClose();
}



void CChapter2_3Dlg::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	CString strMessage;
	strMessage.Format(_T("Key is presses. Key id: %d"), nChar);
	AfxMessageBox(strMessage);
	
	CDialog::OnKeyUp(nChar, nRepCnt, nFlags);
}

⌨️ 快捷键说明

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