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?
Loggy_yyjAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
GloriousRainConnect With a Mentor Commented:
CMenu *pSysMenu = this->GetSystemMenu(FALSE);
pSysMenu->ModifyMenu(SC_MOVE, MF_GRAYED | MF_BYCOMMAND, 0, "&Move");

0
 
mickeerCommented:
Hi!


use:

pSysMenu->EnableMenuItem( SC_MOVE, MF_DISABLE );

instead.

/Micke

0
 
mickeerCommented:
Hi again!

sorry but I misspelled, it should be:

pSysMenu->EnableMenuItem( SC_MOVE, MF_DISABLED );

/Micke



0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Loggy_yyjAuthor Commented:
Thank you!
But in my application, it still doesn't works by replacing your code.
0
 
MadYugoslavCommented:
pSysMenu->EnableMenuItem(SC_MOVE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
0
 
Meir RivkinFull stack Software EngineerCommented:
GloriousRain's comment is working perfectly...
0
 
Loggy_yyjAuthor Commented:
Only the
pSysMenu->ModifyMenu(SC_MOVE, MF_GRAYED | MF_BYCOMMAND, 0, "&Move"); calling works;

I don't know why?

Thanks for your helps!

0
 
SrinivasaRaoCommented:
I think its like
pSysMenu->EnableMenuItem( SC_MOVE, MF_BYCOMMAND | MF_DISABLED );
BSR
0
 
MadYugoslavCommented:
I can't beleive that my comment don't work. It work fine in several places in my apps.
0
 
GloriousRainCommented:
Have you try with SC_MOVE, MadYuqoslav?
0
 
MadYugoslavCommented:
Now I try with SC_MOVE and thing don't work. Really don't know why ?
0
 
GloriousRainCommented:
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.
0
 
Loggy_yyjAuthor Commented:
Thank you very much! Mr. GloriousRain!
0
 
Roshan DavisCommented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.