Solved

window menu - disable move item

Posted on 2003-11-22
1
253 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 34

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

632 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