Jump to content

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


Joshuaaaa
 Share

Recommended Posts

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...