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

📄 ccsd.txt

📁 建立消息映射 代码包含有消息映射
💻 TXT
字号:
// button2.cpp
#include <afxwin.h>
#define IDB_BUTTON 100
// Declare the application class
class CButtonApp : public CWinApp
{
public:
	virtual BOOL InitInstance();
};
// Create an instance of the application class
CButtonApp ButtonApp;  
// Declare the main window class
class CButtonWindow : public CFrameWnd
{ 
	CButton *button;
public:
	CButtonWindow();
	afx_msg void HandleButton();
	DECLARE_MESSAGE_MAP()	 
};
// The message handler function
void CButtonWindow::HandleButton()
{
	MessageBeep(-1);
}
// The message map
BEGIN_MESSAGE_MAP(CButtonWindow, CFrameWnd)
	ON_BN_CLICKED(IDB_BUTTON, HandleButton)
END_MESSAGE_MAP()
// The InitInstance function is called once
// when the application first executes
BOOL CButtonApp::InitInstance()
{
	m_pMainWnd = new CButtonWindow();
	m_pMainWnd->ShowWindow(m_nCmdShow);
	m_pMainWnd->UpdateWindow();
	return TRUE;
}
// The constructor for the window class
CButtonWindow::CButtonWindow()
{ 
	CRect r;
	// Create the window itself
	Create(NULL, 
		"CButton Tests", 
		WS_OVERLAPPEDWINDOW,
		CRect(0,0,200,200));
	// Get the size of the client rectangle
	GetClientRect(&r);
	r.InflateRect(-20,-20);
	// Create a button
	button = new CButton();
	button->Create("Push me",
		WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
		r,
		this,
		IDB_BUTTON);
}

⌨️ 快捷键说明

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