Solved

window menu - disable move item

Posted on 2003-11-22
1
245 Views
Last Modified: 2010-04-05
I've tried disable the move item from the window menu.
EnableMenuItem only worked for the Close item.
Can someone show me a source code which disables the move item?
0
Comment
Question by:qweqwe
1 Comment
 
LVL 33

Accepted Solution

by:
Slick812 earned 125 total points
ID: 9804564
the system menu is a dymanic menu which the system checks certain thing and can change the menu (minimize, maximize), so in order to change a system menu you will have to catch it each time it is going to be shown and change it (disable move), you can NOT change it just once and expect it to stay that way, I get the WM_INITMENUPOPUP message and disable the menu item. . . . . here is some code that can disable the Move menu item in the system menu, first the form's OnCreate procedure which get's the sys menu handle


  private
    { Private declarations }
    hSysMenu: Integer;
    procedure MenuPopup(var Msg: TMessage); message WM_INITMENUPOPUP;


procedure TForm1.FormCreate(Sender: TObject);
begin
hSysMenu := GetSystemMenu(Handle, False);
end;


procedure TForm1.MenuPopup(var Msg: TMessage);
begin
Inherited;
if Msg.wParam = hSysMenu then
EnableMenuItem(hSysMenu, SC_MOVE, MF_BYCOMMAND or MF_GRAYED);
end;
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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

930 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

11 Experts available now in Live!

Get 1:1 Help Now