Solved

window menu - disable move item

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Suggested Solutions

Title # Comments Views Activity
LAN or WAN ? 11 121
control image tags in a string ? 12 171
JAudiorecorder record freezing the app 29 92
Breakpoint doesn't stop in my variable 3 48
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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

751 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