modalframewnd.cpp

来自「主要介绍vc++6.0的编程过程」· C++ 代码 · 共 73 行

CPP
73
字号
// ModalFrameWnd.cpp : implementation file
//

#include "stdafx.h"
#include "ModalWin.h"
#include "ModalFrameWnd.h"

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

/////////////////////////////////////////////////////////////////////////////
// ModalFrameWnd

IMPLEMENT_DYNCREATE(ModalFrameWnd, CFrameWnd)

ModalFrameWnd::ModalFrameWnd()
{
}

ModalFrameWnd::~ModalFrameWnd()
{
}


BEGIN_MESSAGE_MAP(ModalFrameWnd, CFrameWnd)
	//{{AFX_MSG_MAP(ModalFrameWnd)
	ON_WM_CREATE()
	ON_WM_CLOSE()
	ON_WM_LBUTTONDBLCLK()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// ModalFrameWnd message handlers

int ModalFrameWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
	
	return 0;
}

void ModalFrameWnd::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	// Since it will not be destroyed here
	// hide the modal frame window
	ShowWindow( SW_HIDE ); 

	// End the modal loop, started in OnViewGoModal()
	// Return true or any other value you desire
    EndModalLoop( TRUE );

	// Re-enable the main application window
   ::EnableWindow( AfxGetApp()->m_pMainWnd->m_hWnd, TRUE ); 
	 
}

void ModalFrameWnd::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	
	CFrameWnd::OnLButtonDblClk(nFlags, point);
	OnClose();
}

⌨️ 快捷键说明

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