Jump to content

Gui Disabling Close Button


Recommended Posts

i am trying to disable the top right X on a gui i created. i was able to search the forums but i only found disabling minimize and maximize, can someone point me in the right direction to disable the close button. Thank you.

I can't test it right now, but did you try the $WS_DLGFRAME style when creating your GUI?

:think:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Another possibility (from MSDN):

#include <GUIConstants.au3>

Opt('GUICloseOnEsc', 0)

Global Const $SC_CLOSE      = 0xF060
Global Const $MF_GRAYED     = 0x00000001

$hGUI   = GUICreate('Test')
$Btn    = GUICtrlCreateButton('Exit', 100, 100, 70, 25)
GUISetState()

$hMenu = DllCall('user32.dll', 'int', 'GetSystemMenu', 'hwnd', $hGUI, 'int', 0)
DllCall('user32.dll', 'int', 'EnableMenuItem', 'hwnd', $hMenu[0], 'int', $SC_CLOSE, 'int', $MF_GRAYED)

Do
    $Msg = GUIGetMsg()
Until $Msg = $Btn

Greets

Holger

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...