Hello all,
Can you send me a sample showing how to disable minimize and maximize buttons on main window MDI
Thank you
#include "FiveWin.ch"
function Main()
local oWnd
DEFINE WINDOW oWnd STYLE nOr( WS_CAPTION, WS_VISIBLE, WS_SYSMENU ) MDI
ACTIVATE WINDOW oWnd
return nil
#include "FiveWin.ch"
#define MF_BYPOSITION 1024 // 0x0400
#define MF_DISABLED 2
function Main()
local oWnd
DEFINE WINDOW oWnd FROM 1, 1 TO 20, 70 STYLE nOR(WS_POPUP, WS_VISIBLE, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME,WS_MINIMIZEBOX) MDI
ACTIVATE WINDOW oWnd ON INIT RemoveMItems(oWnd, .T.)
return nil
***********
FUNCTION RemoveMItems(oWin, lDisable)
LOCAL hMenu := 0
LOCAL nCount := 0
IF lDisable
hMenu = GetSystemMenu(oWin:hWnd, .F.)
nCount = GetMItemCount(hMenu)
IF oWin:ClassName() = "TDIALOG"
RemoveMenu(hMenu, 1, nOR( MF_BYPOSITION, MF_DISABLED) )
ELSE
RemoveMenu(hMenu, nCount - 3, nOR( MF_BYPOSITION, MF_DISABLED) )
RemoveMenu(hMenu, nCount - 7, nOR( MF_BYPOSITION, MF_DISABLED) )
ENDIF
DrawMenuBar( oWin:hWnd )
ELSE
GetSystemMenu( oWin:hWnd, .T. )
DrawMenuBar( oWin:hWnd )
ENDIF
RETURN nil
DEFINE WINDOW oWnd MDICHILD OF WndMain() FROM 0.5,2 to 27.5,47 TITLE "Quick Search" ;
ICON oAppIcon COLOR oApp:nTextClr, oApp:nBkgClr
DEFINE WINDOW oWnd MDICHILD OF WndMain() FROM 0.5,2 to 27.5,47 TITLE "Quick Search" ;
ICON oAppIcon COLOR oApp:nTextClr, oApp:nBkgClr ;
STYLE nOR(WS_POPUP, WS_VISIBLE, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME,WS_MINIMIZEBOX)
Called from: source\rtl\tobject.prg => TMDICHILD:ERROR(172)
Called from: source\rtl\tobject.prg => TMDICHILD:MSGNOTFOUND(205)
Called from: source\rtl\tobject.prg => TMDICHILD:DEFCONTROL(0)
Called from: .\source\classes\SAY.PRG => TSAY:NEW(145)
Called from: .\CStock.PRG => QUICKSEARCH(509)
DEFINE WINDOW oWnd MDICHILD of WndMain() ;
STYLE nOr( WS_CAPTION, WS_VISIBLE, WS_SYSMENU, WS_MINIMIZEBOX )
ACTIVATE WINDOW oWnd
It is true that we can disable maximize or minimize buttons by simply using clauses NOMAXIMIZE, NOMINIMIZE, etc. while creating the window. But still the user can resize the window by dragging the right bottom corner of the window.
aMinMaxInfo gives us the full control on resizing. ( We can also control with ON RESIZE clause, but that is not elegant )
STYLE nOr( WS_CAPTION, WS_VISIBLE, WS_SYSMENU, WS_MINIMIZEBOX )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 105 guests