|
|
||||||
|
#1
|
|
|
|
|
Why does this code not work in my dialog application:
CMenu *pMenu = ::AfxGetMainWnd()->GetSystemMenu(false); pMenu->EnableMenuItem(SC_CLOSE,MF_BYCOMMAND | MF_GRAYED); pMenu->EnableMenuItem(SC_MINIMIZE,MF_BYCOMMAND|MF_GRAYED ); pMenu->EnableMenuItem(SC_MAXIMIZE,MF_BYCOMMAND |MF_GRAYED); It only disables and greys out the close button and not the minimize or maximize buttons. I had to use instead: SetWindowLong(m_hWnd,GWL_STYLE,GetWindowLong(m_hWn d ,GWL_STYLE) &(~WS_MINIMIZEBOX ) ); ::ValidateRect(NULL,NULL); which removes them and does not grey them out as I would like. It is a solution, but not the one I really wanted. Z.K. |
|
|
|
#2
|
|
|
|
|
Z.K. wrote:
> Why does this code not work in my dialog application: > > CMenu *pMenu = ::AfxGetMainWnd()->GetSystemMenu(false); > pMenu->EnableMenuItem(SC_CLOSE,MF_BYCOMMAND | MF_GRAYED); > pMenu->EnableMenuItem(SC_MINIMIZE,MF_BYCOMMAND|MF_GRAYED ); > pMenu->EnableMenuItem(SC_MAXIMIZE,MF_BYCOMMAND |MF_GRAYED); > > It only disables and greys out the close button and not the minimize or > maximize buttons. I had to use instead: I have not tried to handle system menu messages, but this should get you started: http://www.philosophicalgeek.com/2002/08/14/47/ from a google search: override "system menu" ui handler mfc Best, Dan. |
|
|
| Similar Threads | |
| How to add "minimize" button for the dialog How to add "minimize" button for the dialog - that is - the little "x" on the top right of the window? |
|
| getting a minimize button in dialog based apps to work Hello, I have created a dialog based app for my mobile 2003 device and I get an 'ok' button in the top right of the screen. If I press the 'ok' button my application closes.... |
|
| Context help & minimize button in dialog Hi, Is there any way to get the context help button to work (as opposed to simply appear on the title bar) when a dialog has a minimize button? The dialog is the main... |
|
| Dialog app lacks Minimize button? Hi Folks, I wrote a simple program for myself, but I noticed that there is no Minimize button on the title bar. Can anyone tell me how to rectify this? Thanks! F |
|
|
All times are GMT. The time now is 02:03 AM. | Privacy Policy
|