From e0a5a6d15b404c4ebec0e0fa4ac0d2a08e297aa4 Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 22 Jul 2010 04:47:44 +0000 Subject: [PATCH] win32: remove some system menu items from the window if borderstyle = bsDialog to behave the same as standard windows dialogs and delphi dialogs git-svn-id: trunk@26770 - --- lcl/interfaces/win32/win32wsforms.pp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lcl/interfaces/win32/win32wsforms.pp b/lcl/interfaces/win32/win32wsforms.pp index 8a27a67df1..a09408653d 100644 --- a/lcl/interfaces/win32/win32wsforms.pp +++ b/lcl/interfaces/win32/win32wsforms.pp @@ -360,6 +360,7 @@ var Params: TCreateWindowExParams; lForm: TCustomForm absolute AWinControl; Bounds: TRect; + SystemMenu: HMenu; begin // general initialization of Params PrepareCreateWindow(AWinControl, AParams, Params); @@ -403,6 +404,18 @@ begin FinishCreateWindow(AWinControl, Params, false); Result := Params.Window; + + // remove system menu items for bsDialog + if lForm.BorderStyle = bsDialog then + begin + SystemMenu := GetSystemMenu(Result, False); + DeleteMenu(SystemMenu, SC_RESTORE, MF_BYCOMMAND); + DeleteMenu(SystemMenu, SC_SIZE, MF_BYCOMMAND); + DeleteMenu(SystemMenu, SC_MINIMIZE, MF_BYCOMMAND); + DeleteMenu(SystemMenu, SC_MAXIMIZE, MF_BYCOMMAND); + DeleteMenu(SystemMenu, 1, MF_BYPOSITION); // remove the separator between move and close + end; + // Beginning with Windows 2000 the UI in an application may hide focus // rectangles and accelerator key indication. According to msdn we need to // initialize all root windows with this message