Chorda Posted October 16, 2008 Posted October 16, 2008 Hi, I'm trying to close a window using the $GUI_EVENT_CLOSE, but it does not close. Here is my code: CODE#include <GUIConstants.au3> #include <GUIConstantsEx.au3> GUICreate("Hello World", 200, 100) Opt("GUIEventOptions",1) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") ;HotKeySet('{esc}', 'CLOSEClicked') ;Press the Esc key to exit out Opt("GUICloseOnESC",1) Sleep(2000) Func CLOSEClicked() Exit EndFunc Further, when I use Opt("GUICloseOnESC",1) it does not close, but when I use HotKeySet('{esc}', 'CLOSEClicked') , then it closes. So it seems to me that the $GUI_EVENT_CLOSE does not do its job. Any idea? Thanks
dbzfanatic Posted October 16, 2008 Posted October 16, 2008 (edited) There's not a problem with the windows message,there's a problem with your code. There was a topic earlier today that I helped with that had the same problem. In fact it's ~11 topics down from this one at the time of my post.http://www.autoitscript.com/forum/index.php?showtopic=82765 Edited October 16, 2008 by dbzfanatic Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote]
enaiman Posted October 16, 2008 Posted October 16, 2008 Not really a solution for his problem ... The problem in your script is that you don't have Opt("GUIOnEventMode",1) - that confuses the GUI and that's the reason it doesn't work. This works perfect: #include <GUIConstants.au3> #include <GUIConstantsEx.au3> GUICreate("Hello World", 200, 100) Opt("GUIOnEventMode",1) ;changed your line with this ;you can add Opt("GUIEventOptions",1) if you need it and it willl work GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") ;HotKeySet('{esc}', 'CLOSEClicked') ;Press the Esc key to exit out Opt("GUICloseOnESC",1) Sleep(2000) Func CLOSEClicked() Exit EndFunc SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
Chorda Posted October 16, 2008 Author Posted October 16, 2008 Yes, that solved it. Thanks a lot enaiman.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now