Solved

How to disable "Move" system menu item

Posted on 2001-06-12
14
750 Views
Last Modified: 2013-11-20
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
Comment
Question by:Loggy_yyj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 3
  • +4
14 Comments
 

Expert Comment

by:mickeer
ID: 6184766
Hi!


use:

pSysMenu->EnableMenuItem( SC_MOVE, MF_DISABLE );

instead.

/Micke

0
 

Expert Comment

by:mickeer
ID: 6184774
Hi again!

sorry but I misspelled, it should be:

pSysMenu->EnableMenuItem( SC_MOVE, MF_DISABLED );

/Micke



0
 

Author Comment

by:Loggy_yyj
ID: 6184851
Thank you!
But in my application, it still doesn't works by replacing your code.
0
Three Considerations for Containers

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read our article on Experts Exchange.

 
LVL 2

Expert Comment

by:MadYugoslav
ID: 6184883
pSysMenu->EnableMenuItem(SC_MOVE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
0
 
LVL 2

Accepted Solution

by:
GloriousRain earned 19 total points
ID: 6184978
CMenu *pSysMenu = this->GetSystemMenu(FALSE);
pSysMenu->ModifyMenu(SC_MOVE, MF_GRAYED | MF_BYCOMMAND, 0, "&Move");

0
 
LVL 42

Expert Comment

by:sedgwick
ID: 6184994
GloriousRain's comment is working perfectly...
0
 

Author Comment

by:Loggy_yyj
ID: 6185017
Only the
pSysMenu->ModifyMenu(SC_MOVE, MF_GRAYED | MF_BYCOMMAND, 0, "&Move"); calling works;

I don't know why?

Thanks for your helps!

0
 

Expert Comment

by:SrinivasaRao
ID: 6185027
I think its like
pSysMenu->EnableMenuItem( SC_MOVE, MF_BYCOMMAND | MF_DISABLED );
BSR
0
 
LVL 2

Expert Comment

by:MadYugoslav
ID: 6185032
I can't beleive that my comment don't work. It work fine in several places in my apps.
0
 
LVL 2

Expert Comment

by:GloriousRain
ID: 6185043
Have you try with SC_MOVE, MadYuqoslav?
0
 
LVL 2

Expert Comment

by:MadYugoslav
ID: 6185120
Now I try with SC_MOVE and thing don't work. Really don't know why ?
0
 
LVL 2

Expert Comment

by:GloriousRain
ID: 6185178
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
 

Author Comment

by:Loggy_yyj
ID: 6185368
Thank you very much! Mr. GloriousRain!
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9484658
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question