MFC禁用关闭按钮、最小化、最大化

禁用关闭按钮

BOOL TestResultText::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	::EnableMenuItem(::GetSystemMenu(this->m_hWnd, false), SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);//forbid close

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

禁用最小化、最大化

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	if( !CFrameWnd::PreCreateWindow(cs) )
		return FALSE;
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	cs.style&=~(WS_MAXIMIZEBOX|WS_MINIMIZEBOX); 
	


	return TRUE;
}


猜你喜欢

转载自blog.csdn.net/weiwei_c/article/details/8738917
今日推荐