Solved

window menu - disable move item

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
creating manifest for my dll that called from activex 6 112
Wininet read php file from internet issue 6 90
Process Javascript errors with Delphi TWebBrowser 1 130
Delphi 2 59
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

786 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