Loggy_yyj
asked on
How to disable "Move" system menu item
I found: in the window's system menu, the "Move" menu item can not be disable by the following code:
CMenu *pSysMenu = this->GetSystemMenu(FALSE) ;
if ( pSysMenu != NULL )
pSysMenu->EnableMenuItem( SC_MOVE, MF_GRAYED );
The "Move" menu item is still enabled when system menu pops;
And the "Close" menu item is no problem!
Why?
CMenu *pSysMenu = this->GetSystemMenu(FALSE)
if ( pSysMenu != NULL )
pSysMenu->EnableMenuItem( SC_MOVE, MF_GRAYED );
The "Move" menu item is still enabled when system menu pops;
And the "Close" menu item is no problem!
Why?
Hi again!
sorry but I misspelled, it should be:
pSysMenu->EnableMenuItem( SC_MOVE, MF_DISABLED );
/Micke
sorry but I misspelled, it should be:
pSysMenu->EnableMenuItem( SC_MOVE, MF_DISABLED );
/Micke
ASKER
Thank you!
But in my application, it still doesn't works by replacing your code.
But in my application, it still doesn't works by replacing your code.
pSysMenu->EnableMenuItem(S C_MOVE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
GloriousRain's comment is working perfectly...
ASKER
Only the
pSysMenu->ModifyMenu(SC_MO VE, MF_GRAYED | MF_BYCOMMAND, 0, "&Move"); calling works;
I don't know why?
Thanks for your helps!
pSysMenu->ModifyMenu(SC_MO
I don't know why?
Thanks for your helps!
I think its like
pSysMenu->EnableMenuItem( SC_MOVE, MF_BYCOMMAND | MF_DISABLED );
BSR
pSysMenu->EnableMenuItem( SC_MOVE, MF_BYCOMMAND | MF_DISABLED );
BSR
I can't beleive that my comment don't work. It work fine in several places in my apps.
Have you try with SC_MOVE, MadYuqoslav?
Now I try with SC_MOVE and thing don't work. Really don't know why ?
Hi loqqy_yyi,
I can't give you an exactly reason because i couldn't find document for this issue.
I can only say my opinion is: SC_MOVE was processed by VC to control position of window's frame (->we can do with SC_CLOSE) so we can't do that with EnableMenuItem. I just use ModifyMenu to change SC_MOVE to 0 so it can't be handled anymore.
I can't give you an exactly reason because i couldn't find document for this issue.
I can only say my opinion is: SC_MOVE was processed by VC to control position of window's frame (->we can do with SC_CLOSE) so we can't do that with EnableMenuItem. I just use ModifyMenu to change SC_MOVE to 0 so it can't be handled anymore.
ASKER
Thank you very much! Mr. GloriousRain!
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by : GloriousRain
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Roshan Davis
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by : GloriousRain
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Roshan Davis
EE Cleanup Volunteer
use:
pSysMenu->EnableMenuItem( SC_MOVE, MF_DISABLE );
instead.
/Micke