Disable [Dim] Close Button "X"
Posted: Thu Aug 21, 2014 9:06 am
Find working example to Disable [Dim] / Enable Close Button "X"
Code: Select all
/*
HMG Sample :
"Demo Disable / Enable Close Button 'X'"
By BPD2000
August 2014
*/
#include <hmg.ch>
PROCEDURE Main()
define window main at 0, 0 width 400 height 300 main title "Demo Disable / Enable Close Button 'X'"
define button click
row 100
col 10
caption 'Click'
action msginfo( 'Just a test' )
end button
define button Disablex
row 140
col 10
caption "Disable X"
action (NOCLOSEDLG(thiswindow.handle), MSGINFO("Disabled Close Button 'X'", "Action"))
end button
define button Enablex
row 180
col 10
caption "Enable X"
action (CLOSEDLG(thiswindow.handle), MSGINFO("Enabled Close Button 'X'", "Action"))
end button
end window
Main.Center
Main.Activate
RETURN // Main()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
#pragma BEGINDUMP
#include "windows.h"
#include "hbapi.h"
HB_FUNC ( NOCLOSEDLG ) // ( hWnd )
{
HMENU hMenu = GetSystemMenu( ( HWND ) hb_parnl( 1 ), FALSE ) ;
EnableMenuItem( hMenu, SC_CLOSE, MF_GRAYED ) ;
}
HB_FUNC ( CLOSEDLG ) // ( hWnd ) MF_ENABLED
{
HMENU hMenu = GetSystemMenu( ( HWND ) hb_parnl( 1 ), FALSE ) ;
EnableMenuItem( hMenu, SC_CLOSE, MF_ENABLED ) ;
}
#pragma ENDDUMP
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.