15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


System menu for the property sheet window

Tipparaju Surendra -- tips@hotmail.com
Monday, January 20, 1997


Environment: VC++ 4.0, Win 95

Hello,

I am using Property sheet dialog as the main window in
my application. Its is similar to dialog based application.
By default MFC removes the system menu for property sheets.
I want to get it back on my application. I tried my overriding
WM_CREATE and after calling property sheets's OnCreate()
function, I called GetSystemMenu(TRUE), but it does not
work.

Can somebody help me with the solution.

Thanks in advance
Tips 

---------------------------------------------------------
Get Your *Web-Based* Free Email at http://www.hotmail.com
---------------------------------------------------------



Pradeep -- Tamanna@albpig.cho.ge.com
Tuesday, January 21, 1997

[Mini-digest: 5 responses]


Hi,

The 'GetSystemMenu( )' function allows the application to access the   
System menu (also known as the Control menu), if the window has one, for   
copying and modifying. Setting the 'BOOL bRevert' parameter  TRUE does   
nothing more than resetting the System menu, if available, back to the   
Windows default state.

In order to get back the system menu for ur property sheet, u may try   
using the window style WS_SYSMENU along with WS_CAPTION style during the   
property sheet window creation.

bye,
Pradeep


 ----------
From:  owner-mfc-l
Sent:  Monday, January 20, 1997 5:12 AM
To:  mfc-l
Subject:  System menu for the property sheet window


Environment: VC++ 4.0, Win 95

Hello,

I am using Property sheet dialog as the main window in
my application. Its is similar to dialog based application.
By default MFC removes the system menu for property sheets.
I want to get it back on my application. I tried my overriding
WM_CREATE and after calling property sheets's OnCreate()
function, I called GetSystemMenu(TRUE), but it does not
work.

Can somebody help me with the solution.

Thanks in advance
Tips

 ---------------------------------------------------------
Get Your *Web-Based* Free Email at http://www.hotmail.com
 ---------------------------------------------------------

-----From: Simon Coghlan 

After some fiddling this is how I got it to look ..
I can send the whole code if you like..

> I am using Property sheet dialog as the main window in
> my application. Its is similar to dialog based application.

In your App Instance you might do something like this :

BOOL CMgtApp::InitInstance()
{
;;;
CMyPropSheet MyPropSheet("Thingy");
// Bring up the property sheet just like a modal dialog
MyPropSheet.DoModal();
return FALSE;
}

Then in the Derived PropSheet code have something like :
//////////////////////////////////////////////////////////////////////////////
// OnInitDialog
// 26/11/96		Development started
//
BOOL CMyPropSheet::OnInitDialog() 
{
HWND hWnd = GetSafeHwnd();
LONG lStyle = GetWindowLong( hWnd, GWL_STYLE );
SetWindowLong( hWnd, GWL_STYLE, (lStyle | WS_MAXIMIZEBOX) );
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
// Add "About..." menu item to system menu. and remove the other rubish
CMenu* pSysMenu = GetSystemMenu(FALSE);
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
//	pSysMenu->RemoveMenu( SC_SIZE, MF_BYCOMMAND );
	pSysMenu->AppendMenu( MF_STRING, SC_RESTORE, "&Restore" );
	pSysMenu->AppendMenu( MF_STRING, SC_MAXIMIZE, "Ma&ximize" );
	pSysMenu->AppendMenu( MF_SEPARATOR );
	pSysMenu->AppendMenu( MF_STRING, IDM_ABOUTBOX, strAboutMenu );
}
// Activate the Apply Button
GetDlgItem( ID_APPLY_NOW )->EnableWindow();
// Hide the Help button
GetDlgItem( IDHELP )->ShowWindow( SW_HIDE );
CBOOL cbStatus = CPropertySheet::OnInitDialog();
m_bInit_Done = TRUE;
return( cbStatus );
}		// End CMyPropSheet::OnInitDialog


> By default MFC removes the system menu for property sheets.
> I want to get it back on my application. I tried my overriding
> WM_CREATE and after calling property sheets's OnCreate()
> function, I called GetSystemMenu(TRUE), but it does not
> work.
> 

---------
Simon 
----------<- Smurf-IV ->-------------
Tel : 0121 200 7713
Fax : +44 (0)121 212 0379
Email smurf-iv@sharelink.com
Member of the 'Team of CIS' ;-)
---------<- Fun To All ->------------
We are what we repeatedly do, Excellence, then, is not an act, but a habit.
Aristotle
The one who says it cannot be done, should never interrupt the one who is doing it.
The Roman Rule


On 20 January 1997 05:12, Tipparaju Surendra wrote:

-----From: mfc-l@netcom.com

>From mfc-l Wed Jan 22 19:46:56 1997 remote from netcom.com
Received: from netcom.com by tc4d1.cmc.stph.net; Wed, 22 Jan 1997 20:27 EST
Received: by majordomo.netcom.com (8.7.5/8.7.3/(NETCOM MLS v1.01)) id IAA07193; Tue, 21 Jan 1997 08:41:58 -0800 (PST)
Date: 20 Jan 1997 05:12:06 -0000
Message-ID: <19970120051206.18999.qmail@hotmail.com>
X-Originating-IP: [202.239.121.26]
From: "Tipparaju Surendra" 
To: mfc-l@netcom.com
Subject: System menu for the property sheet window
Sender: owner-mfc-l@majordomo.netcom.com
Errors-To: owner-mfc-l@majordomo.netcom.com
Precedence: bulk
Reply-To: mfc-l@netcom.com
Content-Type: text/plain
Content-Length: 638


Environment: VC++ 4.0, Win 95

Hello,

I am using Property sheet dialog as the main window in
my application. Its is similar to dialog based application.
By default MFC removes the system menu for property sheets.
I want to get it back on my application. I tried my overriding
WM_CREATE and after calling property sheets's OnCreate()
function, I called GetSystemMenu(TRUE), but it does not
work.

Can somebody help me with the solution.

Thanks in advance
Tips 

---------------------------------------------------------
Get Your *Web-Based* Free Email at http://www.hotmail.com
---------------------------------------------------------
-----From: mfc-l@netcom.com

>From mfc-l Wed Jan 22 19:46:56 1997 remote from netcom.com
Received: from netcom.com by tc4d1.cmc.stph.net; Wed, 22 Jan 1997 20:26 EST
Received: by majordomo.netcom.com (8.7.5/8.7.3/(NETCOM MLS v1.01)) id IAA07193; Tue, 21 Jan 1997 08:41:58 -0800 (PST)
Date: 20 Jan 1997 05:12:06 -0000
Message-ID: <19970120051206.18999.qmail@hotmail.com>
X-Originating-IP: [202.239.121.26]
From: "Tipparaju Surendra" 
To: mfc-l@netcom.com
Subject: System menu for the property sheet window
Sender: owner-mfc-l@majordomo.netcom.com
Errors-To: owner-mfc-l@majordomo.netcom.com
Precedence: bulk
Reply-To: mfc-l@netcom.com
Content-Type: text/plain
Content-Length: 638


Environment: VC++ 4.0, Win 95

Hello,

I am using Property sheet dialog as the main window in
my application. Its is similar to dialog based application.
By default MFC removes the system menu for property sheets.
I want to get it back on my application. I tried my overriding
WM_CREATE and after calling property sheets's OnCreate()
function, I called GetSystemMenu(TRUE), but it does not
work.

Can somebody help me with the solution.

Thanks in advance
Tips 

---------------------------------------------------------
Get Your *Web-Based* Free Email at http://www.hotmail.com
---------------------------------------------------------
-----From: ktm@ormec.com

Tips (tips@hotmail.com) wrote:
> Environment: VC++ 4.0, Win 95
> I am using Property sheet dialog as the main window in my application. 
> Its is similar to dialog based application. By default MFC removes the 
> system menu for property sheets. I want to get it back on my application. 
> I tried my overriding WM_CREATE and after calling property sheets's 
> OnCreate() function, I called GetSystemMenu(TRUE), but it does not work.

I expect that GetSystemMenu(TRUE) is working exactly as documented. It 
makes the System menu revert to the default state. In this case, you never 
had a menu to begin with, so it doesn't do anything.

To add a system menu to a property sheet, you need to call 
  ModifyStyle(0, WS_SYSMENU, 0);
in OnInitDialog of your CPropertySheet-derived class.

Since this is a dialog-box style application, you may want to remove the 
Size and Maximize menu items from the system menu after you add it:

    // The default system menu has several menu items that don't make
    // sense for this dialog box. Remove or hide them as appropriate.
    CMenu* pSystemMenu = GetSystemMenu(FALSE);
    ASSERT(pSystemMenu != NULL);

    pSystemMenu->DeleteMenu(SC_SIZE, MF_BYCOMMAND);
    pSystemMenu->DeleteMenu(SC_MAXIMIZE, MF_BYCOMMAND);
    // You might want to DeleteMenu on SC_MINIMIZE and SC_RESTORE, too

    // The close box will always be displayed in the caption bar, so 
    // it ought to show up in the menu, too. The user should use the
    // dialog's Close button to close it, so disable the menu item.
    // This also disables the close box.
    pSystemMenu->EnableMenuItem(SC_CLOSE, MF_BYCOMMAND|MF_GRAYED);

  Katy
-- 
Katy Mulvey                            ktm@ormec.com
Software Development Engineer
ORMEC Systems                          http://www.ormec.com




| Вернуться в корень Архива |