Solved

How to disable "Move" system menu item

Posted on 2001-06-12
14
727 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Both in life and business – not all partnerships are created equal. Spend 30 short minutes with us to learn:   • Key questions to ask when considering a partnership to accelerate your business into the cloud • Pitfalls and mistakes other partners…

911 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

20 Experts available now in Live!

Get 1:1 Help Now