Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CMainFrame?

Status
Not open for further replies.

SamuelChae

Programmer
Mar 14, 2001
4
US
hnow would i get the frame window of an SDI application to have the X button be disabled?
 
Hi

When You make the action that toggle the state of the X button, call the following code:

// Get System Menu
CMenu* pSysMenu = AfxGetMainWnd()->GetSystemMenu( FALSE);
or
CMenu* pSysMenu = AfxGetApp()->m_pMainWnd->GetSystemMenu( FALSE);

// Safety Check
if ( pSysMenu == ( CMenu*) NULL)
return;

// This is for the sample - Use anything relavant
BOOL bDisable = TRUE ;

// Update System Menu State
pSysMenu->EnableMenuItem( SC_CLOSE, bDisable ?
MF_DISABLED | MF_GRAYED | MF_BYCOMMAND : MF_ENABLED | MF_BYCOMMAND);


Thierry
Thierry.Marneffe@swing.be
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top