?? button.h
字號:
// Button.h: interface for the buttons and edit class.
//
//////////////////////////////////////////////////////////////////////
#ifndef __ATLBTN_H__
#define __ATLBTN_H__
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CEditEx : public CWindowImpl<CEditEx, CEdit>
{
public:
BEGIN_MSG_MAP(CEditEx)
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()
BOOL PreTranslateMessage(MSG* pMsg)
{
return FALSE;
}
LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
ATLTRACE(_T("CEditEx::OnKeyDown()\n"));
// If an 'Enter' key was pressed
if (wParam == VK_RETURN)
{
// Do a search
::SendMessage(GetParent(), WMU_FINDNOTE, 0, 0);
return 0;
}
// If any other key do not handle the message
bHandled = FALSE;
return 0;
}
};
class CButtonExCancel : public CWindowImpl<CButtonExCancel, CButton>
{
public:
BEGIN_MSG_MAP(CButtonExCancel)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()
BOOL PreTranslateMessage(MSG* pMsg)
{
return FALSE;
}
// Handles clicking on 'Cancel' button
LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
ATLTRACE(_T("CButtonExCancel::OnLButtonDown()\n"));
// Close the search dialog
// Can't use SendMessage(), because by the time SendMessage() returns
// object's gone
::PostMessage(GetParent(), WM_CLOSE, 0, 0);
return 0;
}
// Handles pressing the 'Enter' key when 'Cancel' button has a focus
LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
ATLTRACE(_T("CButtonExCancel::OnKeyDown()\n"));
// Close the search dialog
// Can't use SendMessage(), because by the time SendMessage() returns
// object's gone
::PostMessage(GetParent(), WM_CLOSE, 0, 0);
return 0;
}
};
class CButtonExFind : public CWindowImpl<CButtonExFind, CButton>
{
public:
BEGIN_MSG_MAP(CButtonExFind)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()
BOOL PreTranslateMessage(MSG* pMsg)
{
return FALSE;
}
// Handles clicking on 'Find' button
LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
ATLTRACE(_T("CButtonExFind::OnLButtonDown()\n"));
// Do a search
::SendMessage(GetParent(), WMU_FINDNOTE, 0, 0);
return 0;
}
// Handles pressing the 'Enter' key when 'Find' button has a focus
LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
ATLTRACE(_T("CButtonExFind::OnKeyDown()\n"));
// Do a search
::SendMessage(GetParent(), WMU_FINDNOTE, 0, 0);
return 0;
}
};
class CButtonExNew : public CWindowImpl<CButtonExNew, CButton>
{
public:
BEGIN_MSG_MAP(CButtonExNew)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()
BOOL PreTranslateMessage(MSG* pMsg)
{
return FALSE;
}
// Handles clicking on 'New note' button
LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
ATLTRACE(_T("CButtonExNew::OnLButtonDown()\n"));
// Send a message to create a new Note dialog
::SendMessage(GetParent(), WMU_NEWNOTE, 0, 0);
return 0;
}
// Handles pressing the 'Enter' key when 'New Note' button has a focus
LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
ATLTRACE(_T("CButtonExNew::OnKeyDown()\n"));
// Send a message to create a new Note dialog
::SendMessage(GetParent(), WMU_NEWNOTE, 0, 0);
return 0;
}
};
/************************************************************************/
#endif // __ATLBTN_H__
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -