?? hardwarekeysampledlg.cpp
字號:
// HardwareKeySampleDlg.cpp : implementation file
//
#include "stdafx.h"
#include "HardwareKeySample.h"
#include "HardwareKeySampleDlg.h"
#include "STUtil.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CHardwareKeySampleDlg dialog
CHardwareKeySampleDlg::CHardwareKeySampleDlg(CWnd* pParent /*=NULL*/)
: CDialog(CHardwareKeySampleDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CHardwareKeySampleDlg)
// 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 CHardwareKeySampleDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CHardwareKeySampleDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CHardwareKeySampleDlg, CDialog)
//{{AFX_MSG_MAP(CHardwareKeySampleDlg)
ON_WM_CLOSE()
ON_WM_KEYUP()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CHardwareKeySampleDlg message handlers
BOOL CHardwareKeySampleDlg::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 CHardwareKeySampleDlg::OnClose()
{
for (int i=0xc1; i<=0xcf; i++) {
UnregisterHotKey(m_hWnd, i);
}
CDialog::OnClose();
}
void CHardwareKeySampleDlg::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 + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -