Solved

window menu - disable move item

Posted on 2003-11-22
1
244 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
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…

708 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