Dialog based application
Jason R. Simpson -- doecreek@tir.com
Friday, December 13, 1996
Environment: VC++ 4.1, Windows95
Even though I disable the maximize button in the upper right hand corner =
of the dialog box through developer studio, the user still has the =
ability to maximize the dialog box. By right clicking on the title bar, =
a menu is displayed that presents the user with the ability to maximize =
the dialog box. I searched for examples of modifying the system menu =
and was able to come up with code for adding menu items. Is there a way =
that I could simply gray out the maximize option on the system menu?
Amir Shoval -- torin@netvision.net.il
Monday, December 16, 1996
[Mini-digest: 4 responses]
Jason R. Simpson wrote:
>
> Environment: VC++ 4.1, Windows95
>
> Even though I disable the maximize button in the upper right hand corner of the dialog box through developer studio, the user still has the ability to maximize the dialog box. By right clicking on the title bar, a menu is displayed that presents the user with the ability to maximize the dialog box. I searched for examples of modifying the system menu and was able to come up with code for adding menu items. Is there a way that I could simply gray out the maximize option on the system menu?
Well, you can just delete the maximize option from the system menu.
Try:
CMenu* pMenu = GetSystemMenu (FALSE);
pMenu->DeleteMenu (SC_MAXIMIZE, MF_BYCOMMAND);
This (I think) will also prevent the maximizing of the window by
double-clicking the title bar.
Amir
--
--------------------------
Amir Shoval N.C.C. Israel
torin@netvision.net.il
--------------------------
-----From: "Rob Warner"
In your CDialog::OnInitDialog():
CMenu* pSysMenu = GetSystemMenu(FALSE);
// Get rid of Maximize and Size
pSysMenu->DeleteMenu(SC_MAXIMIZE, MF_BYCOMMAND);
pSysMenu->DeleteMenu(SC_SIZE, MF_BYCOMMAND);
HTH.
<<<<<>>>>>
Rob Warner
rhwarner@southeast.net
http://users.southeast.net/~rhwarner
----------
From: Jason R. Simpson
To: 'mfc-l@netcom.com'
Subject: Dialog based application
Date: Friday, December 13, 1996 1:52 PM
Environment: VC++ 4.1, Windows95
Even though I disable the maximize button in the upper right hand corner of
the dialog box through developer studio, the user still has the ability to
maximize the dialog box. By right clicking on the title bar, a menu is
displayed that presents the user with the ability to maximize the dialog
box. I searched for examples of modifying the system menu and was able to
come up with code for adding menu items. Is there a way that I could
simply gray out the maximize option on the system menu?
----------
-----From: Mario Contestabile
yourdlg::OnInitDialog(){
CDialog::OnInitDialog();
// Disable maximize and size
CMenu* menu_ptr = GetSystemMenu(FALSE);
if(menu_ptr){
menu_ptr->EnableMenuItem(SC_MAXIMIZE, MF_BYCOMMAND | MF_DISABLED |
MF_GRAYED);
menu_ptr->EnableMenuItem(SC_SIZE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
}
}
mcontest@universal.com
>Even though I disable the maximize button in the upper right hand corner of
the dialog box through developer studio, the user >still has the ability to
maximize the dialog box. By right clicking on the title bar, a menu is
displayed that presents the user with >the ability to maximize the dialog box.
I searched for examples of modifying the system menu and was able to come up
with >code for adding menu items. Is there a way that I could simply gray out
the maximize option on the system menu?
-----From: "Keith Bottner"
You can actually do this one of two ways. Since you message says that you
know how to handle adding items to the system menu then I will assume you
know how to get the system menu's handle. Take that handle and use the
standard menu API functions to disable the maximize option. Or you can
handle the WM_SYSCOMMAND message handling the SC_MAXIMIZE command request.
If you need further information or examples let me know.
Keith Bottner
kbottner@macromedia.com
----------
From: Jason R. Simpson
To: 'mfc-l@netcom.com'
Subject: Dialog based application
Date: Friday, December 13, 1996 12:52 PM
Environment: VC++ 4.1, Windows95
Even though I disable the maximize button in the upper right hand corner of
the dialog box through developer studio, the user still has the ability to
maximize the dialog box. By right clicking on the title bar, a menu is
displayed that presents the user with the ability to maximize the dialog
box. I searched for examples of modifying the system menu and was able to
come up with code for adding menu items. Is there a way that I could
simply gray out the maximize option on the system menu?
----------
Rick Esterling -- rick@eco.twg.com
Tuesday, December 17, 1996
> Environment: VC++ 4.1, Windows95
> Even though I disable the maximize button in the upper right hand
> corner of the dialog box through developer studio, the user still
> has the ability to maximize the dialog box. By right clicking on
> the title bar, a menu is displayed that presents the user with the
> ability to maximize the dialog box.
Just so you know, they can also dbl-click the title bar or they can use the
system menu of your dialog (upper left hand corner) to maximize the app.
> I searched for examples of modifying the system menu and was able
> to come up with code for adding menu items. Is there a way that
> I could simply gray out the maximize option on the system menu?
So you're sitting there in that big ol' help file on CMenu::AppendMenu and
suddenly you get the idea that this list will have a faster turn around
time than checking out the other member methods of CMenu? Say, for
example, CMenu::EnableMenuItem or CMenu::RemoveMenu? Utterly amazing.
To gray it out:
CMenu* pSysMenu = GetSystemMenu( FALSE );
pSysMenu->EnableMenuItem( SC_MAXIMIZE,
MF_BYCOMMAND | MF_GRAYED );
To remove it altogether:
CMenu* pSysMenu = GetSystemMenu( FALSE );
pSysMenu->RemoveMenu( SC_MAXIMIZE,
MF_BYCOMMAND );
BTW, I feel compelled to add that BOTH calls are not necessary; this is an
either/or kind of thing.
Good luck (and plenty of it),
Rick
--------------------------------------------------------------------
Richard A. Esterling Attachmate Core Technologies Group
Senior Software Engineer Palo Alto, CA 415-962-7252
http://widget.eco.twg.com:1080 http://www.attachmate.com
| Вернуться в корень Архива
|