Solved

How to disable "Move" system menu item

Posted on 2001-06-12
14
725 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
  • 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now