|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Konstantin Matveev
|
Nov 13, 2006 - 7:45 AM
|
Hello! I use ProfUIS 2.54 and SDI application with CExtPaintManagerOffice2007_R2_LunaBlue theme. Sometimes i need to disable "Close" [x] button on system menu. I’ve read manuals and this forum and did that:
// class CMainFrame // method OnCreate
....
CMenu* pSysMenu = GetSystemMenu( FALSE ); if( pSysMenu != NULL ) pSysMenu->EnableMenuItem( SC_CLOSE, MF_DISABLED |MF_GRAYED |MF_BYCOMMAND );
....
It must be works fine, BUT it doesn’t work! Then I create test SDI application without using ProfUIS, and this code works! Please help me! How to disable Close button under ProfUIS ?
|
|
Technical Support
|
Nov 14, 2006 - 2:49 AM
|
To fix this issue, please update the source code for the following method: bool CExtNcFrameImpl::NcFrameImpl_OnQuerySystemCommandEnabled(
UINT nSystemCommandID
)
{
if( nSystemCommandID == SC_RESTORE )
nSystemCommandID = SC_MAXIMIZE;
CWnd * pWndFrameImpl = NcFrameImpl_GetFrameWindow();
if( pWndFrameImpl == NULL )
return false;
CMenu * pSysMenu = pWndFrameImpl->GetSystemMenu( FALSE );
if( pSysMenu == NULL )
return false;
UINT nMenuItemState =
pSysMenu->GetMenuState( nSystemCommandID, MF_BYCOMMAND );
if( nMenuItemState == 0xFFFFFFFF )
return false;
if( (nMenuItemState&(MF_DISABLED|MF_GRAYED)) != 0 )
return false;
DWORD dwStyle = pWndFrameImpl->GetStyle();
if( nSystemCommandID == SC_MINIMIZE )
{
if( (dwStyle&WS_MINIMIZEBOX) == 0 )
return false;
}
if( nSystemCommandID == SC_MAXIMIZE )
{
if( (dwStyle&WS_MAXIMIZEBOX) == 0 )
return false;
}
if( nSystemCommandID == SC_RESTORE || nSystemCommandID == SC_MAXIMIZE )
{
MINMAXINFO _mmi;
::memset( &_mmi, 0, sizeof(MINMAXINFO) );
CExtPaintManager::monitor_parms_t _mp;
CExtPaintManager::stat_GetMonitorParms( _mp, pWndFrameImpl );
_mmi.ptMaxPosition.x = _mp.m_rcWorkArea.left;
_mmi.ptMaxPosition.y = _mp.m_rcWorkArea.top;
_mmi.ptMaxTrackSize.x = _mp.m_rcWorkArea.Width();
_mmi.ptMaxTrackSize.y = _mp.m_rcWorkArea.Height();
_mmi.ptMinTrackSize.x = ::GetSystemMetrics( SM_CXMINTRACK );
_mmi.ptMinTrackSize.y = ::GetSystemMetrics( SM_CYMINTRACK );
_mmi.ptMaxSize.x = _mmi.ptMaxTrackSize.x;
_mmi.ptMaxSize.y = _mmi.ptMaxTrackSize.y;
if( pWndFrameImpl->SendMessage( WM_GETMINMAXINFO, 0, LPARAM(&_mmi) ) == 0 )
{
if( nSystemCommandID == SC_RESTORE )
{
WINDOWPLACEMENT _wp;
::memset( &_wp, 0, sizeof(WINDOWPLACEMENT) );
_wp.length = sizeof(WINDOWPLACEMENT);
pWndFrameImpl->GetWindowPlacement( &_wp );
if( _wp.showCmd == SW_SHOWMINIMIZED
|| _wp.showCmd == SW_SHOWMINNOACTIVE
|| _wp.showCmd == SW_RESTORE
)
return true;
}
if( _mmi.ptMinTrackSize.x >= _mmi.ptMaxTrackSize.x
|| _mmi.ptMinTrackSize.y >= _mmi.ptMaxTrackSize.y
)
return false;
}
}
return true;
}
|
|
Konstantin Matveev
|
Nov 15, 2006 - 2:10 AM
|
Thank you very much! Works fine!
|
|