Sign in to follow this  
Followers 0
Joshuaaaa

How to Grey-Out the X (close) botton?

2 posts in this topic

How can I do this?

Share this post


Link to post
Share on other sites



Hello,

try this:

Func setGUICloseButton($hWnd, $bState = False, $hUser32dll = 'user32.dll')
    Local Const $SC_CLOSE  = 0xF060
    Local Const $MF_ENABLED = 0x00000000
    Local Const $MF_GRAYED = 0x00000001
    Local $hMenu = DllCall($hUser32dll, 'int', 'GetSystemMenu', 'hwnd', $hWnd, 'int', 0)
    If $bState Then
        DllCall($hUser32dll, 'int', 'EnableMenuItem', 'hwnd', $hMenu[0], 'int', $SC_CLOSE, 'int', $MF_ENABLED)
    Else
        DllCall($hUser32dll, 'int', 'EnableMenuItem', 'hwnd', $hMenu[0], 'int', $SC_CLOSE, 'int', $MF_GRAYED)
    EndIf
EndFunc

Use setGUICloseButton($guiWindowID,False) to disable the close button, setGUICloseButton($guiWindowID,True) enables it.

ciao

Xandl

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0