• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 804
  • Last Modified:

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?
0
Loggy_yyj
Asked:
Loggy_yyj
  • 3
  • 3
  • 3
  • +4
1 Solution
 
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
 
Loggy_yyjAuthor Commented:
Thank you!
But in my application, it still doesn't works by replacing your code.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
MadYugoslavCommented:
pSysMenu->EnableMenuItem(SC_MOVE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
0
 
GloriousRainCommented:
CMenu *pSysMenu = this->GetSystemMenu(FALSE);
pSysMenu->ModifyMenu(SC_MOVE, MF_GRAYED | MF_BYCOMMAND, 0, "&Move");

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

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

  • 3
  • 3
  • 3
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now