Solved

How to disable "Move" system menu item

Posted on 2001-06-12
14
736 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 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