Sign in to follow this  
Followers 0
joseedwin

Gui Disabling Close Button

5 posts in this topic

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.

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks PsaltyDS, your approach did help, but i wanted to display the icon as well. My fault for not mentioning this before.

Thanks Holger, your suggestion worked perfectly. Thank you guys!

Share this post


Link to post
Share on other sites

You could also just have the button there and not set Case for it. So even if you click on it nothing happens.


My little company: Evotec (PL version: Evotec)

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