📄 sambtn.cpp
字号:
// SAMBTN.cpp : implementation file
//
#include "stdafx.h"
#include "SAMBTN.h"
#include "mmsystem.h"
#pragma comment (lib,"WINMM.LIB")
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSAMBTN
CSAMBTN::CSAMBTN()
{
}
CSAMBTN::~CSAMBTN()
{
}
BEGIN_MESSAGE_MAP(CSAMBTN, CButton)
//{{AFX_MSG_MAP(CSAMBTN)
ON_WM_MOUSEMOVE()
ON_WM_MOUSEACTIVATE()
ON_WM_DRAWITEM()
ON_WM_SETFOCUS()
ON_WM_LBUTTONUP()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSAMBTN message handlers
void CSAMBTN::OnMouseMove(UINT nFlags, CPoint point)
{
m_pbtn->SetFocus();
//CSAMBTN::OnMouseMove(nFlags, point);
}
int CSAMBTN::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
return CButton::OnMouseActivate(pDesktopWnd, nHitTest, message);
}
void CSAMBTN::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
// TODO: Add your message handler code here and/or call default
CButton::OnDrawItem(nIDCtl, lpDrawItemStruct);
}
void CSAMBTN::OnSetFocus(CWnd* pOldWnd)
{
CButton::OnSetFocus(pOldWnd);
PlaySnd();
// TODO: Add your message handler code here
}
void CSAMBTN::PlaySnd()
{
HINSTANCE h=AfxGetInstanceHandle();
HRSRC hr=FindResource(h,"IDW_HOVER","WAVE");
HGLOBAL hg=LoadResource(h,hr);
LPSTR lp=(LPSTR)LockResource(hg);
sndPlaySound(lp,SND_MEMORY|SND_ASYNC);
FreeResource(hg);
}
void CSAMBTN::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
HINSTANCE h=AfxGetInstanceHandle();
HRSRC hr=FindResource(h,"IDW_PRESS","WAVE");
HGLOBAL hg=LoadResource(h,hr);
LPSTR lp=(LPSTR)LockResource(hg);
sndPlaySound(lp,SND_MEMORY|SND_SYNC);
FreeResource(hg);
CButton::OnLButtonUp(nFlags, point);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -