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

📄 nocloseframe.cpp

📁 这是MFC经典问答书的光盘内容
💻 CPP
字号:
// NoCloseFrame.cpp : implementation file
//

#include "stdafx.h"
#include "dontcloseview.h"
#include "NoCloseFrame.h"

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

/////////////////////////////////////////////////////////////////////////////
// CNoCloseFrame

IMPLEMENT_DYNCREATE(CNoCloseFrame, CMDIChildWnd)

CNoCloseFrame::CNoCloseFrame()
{
}

CNoCloseFrame::~CNoCloseFrame()
{
}


BEGIN_MESSAGE_MAP(CNoCloseFrame, CMDIChildWnd)
	//{{AFX_MSG_MAP(CNoCloseFrame)
	ON_COMMAND(ID_CLOSE_FRAME, OnCloseFrame)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CNoCloseFrame message handlers

BOOL CNoCloseFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext) 
{
	// 1 - Call base class function
	BOOL bRet = CMDIChildWnd::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext);

	if( bRet )
	{
		// 2 - Disable the "Close" command in the System menu
		CMenu* pMenu = GetSystemMenu( FALSE );
		pMenu->EnableMenuItem( SC_CLOSE, MF_BYCOMMAND | MF_GRAYED );
	}

	return bRet;
}

void CNoCloseFrame::OnCloseFrame() 
{
	PostMessage( WM_CLOSE );
}

⌨️ 快捷键说明

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