I would like to remove the X close button on the top right corner of a dialog box.
Any help would be greatly appreciated.
Thanks In Advance Mike.
#define MF_BYPOSITION 1024 // 0x0400
#define MF_DISABLED 2
*******************************************************************************
*** FUNCTION DisableX(oWin, lDisable) to Disable X button of Window/Dialog ***
*******************************************************************************
FUNCTION DisableX(oWin, lDisable)
LOCAL hMenu := 0
LOCAL nCount := 0
IF lDisable
hMenu = GetSystemMenu(oWin:hWnd, .F.)
nCount = GetMItemCount(hMenu)
RemoveMenu(hMenu, nCount - 1, nOR( MF_BYPOSITION, MF_DISABLED) )
RemoveMenu(hMenu, nCount - 2, nOR( MF_BYPOSITION, MF_DISABLED) )
DrawMenuBar( oWin:hWnd )
ELSE
GetSystemMenu( oWin:hWnd, .T. )
DrawMenuBar( oWin:hWnd )
ENDIF
RETURN nil
#define MF_BYPOSITION 1024 // 0x0400
#define MF_DISABLED 2
...
...
DEFINE DIALOG oDlg RESOURCE "Tools" OF oWnd TRANSPARENT ;
TITLE "Selection" FONT oProgFont
...
...
... It works !!
ACTIVATE DIALOG oDlg CENTERED NOWAIT ;
ON INIT ( oDlg:Move( 30 , 50, oDlg:nWidth, oDlg:nHeight, .f. ), ;
DisableX(oDlg, .T.) ) )
RETURN NIL
*******************************************************
*** FUNCTION DisableX(oWin, lDisable) to Disable X button of Window/Dialog ***
*******************************************************
FUNCTION DisableX(oWin, lDisable)
LOCAL hMenu := 0
LOCAL nCount := 0
IF lDisable
hMenu = GetSystemMenu(oWin:hWnd, .F.)
nCount = GetMItemCount(hMenu)
RemoveMenu(hMenu, nCount - 1, nOR( MF_BYPOSITION, MF_DISABLED) )
RemoveMenu(hMenu, nCount - 2, nOR( MF_BYPOSITION, MF_DISABLED) )
DrawMenuBar( oWin:hWnd )
ELSE
GetSystemMenu( oWin:hWnd, .T. )
DrawMenuBar( oWin:hWnd )
ENDIF
RETURN nil
*******************************************************************************
*** FUNCTION DisableX(oWin, lDisable) to Disable X button of Window/Dialog ***
*******************************************************************************
FUNCTION DisableX(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 - 1, nOR( MF_BYPOSITION, MF_DISABLED) )
RemoveMenu(hMenu, nCount - 2, nOR( MF_BYPOSITION, MF_DISABLED) )
ENDIF
DrawMenuBar( oWin:hWnd )
ELSE
GetSystemMenu( oWin:hWnd, .T. )
DrawMenuBar( oWin:hWnd )
ENDIF
RETURN nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 99 guests