jrb1204
asked on
I need to have a form without the red x close button
I need to remove the red x close button on a form. II will handle the close with a button on the form.
I want to keep all other functionality such as minimize, maximize and caption.
I have tried EnableMenuItem(AppSysMenu, SC_CLOSE,M F_BYCOMMAN D or MF_GRAYED) but this only grays it out. Any suggestions ?
I want to keep all other functionality such as minimize, maximize and caption.
I have tried EnableMenuItem(AppSysMenu,
I just re-read your question and I see that you wish to keep minimize, maximize and caption. That will require some more effort. I'll have to do some looking...
I think this is close to what you want.
procedure TForm1.FormCreate(Sender: TObject);
var h : hMenu;
i : Integer;
begin
h := GetSystemMenu(Handle, False );
for i := GetMenuItemCount(h)- 1 downto 0 do
if GetMenuItemID(h,i) = SC_CLOSE then
RemoveMenu(h,i,MF_BYPOSITION);
end;
ASKER
The solution from your last post works to disable the close [x] icon but what I was looking for was a way to hide it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You will want to set biSystemMenu = False;
or at runtime you can do this:
Open in new window