Jump to content
Sign in to follow this  
Daniel W.

Gui Not Working At $gui_event_close

Recommended Posts

Daniel W.

Hi,

i created a GUI with some Buttons and Pics like a Desktop but with checking if the Process is existing etc.

Newbie like things ^^

But i have something that does not work

#include <GUIConstants.au3>

Opt(GuiOnEventMode, 1)

GUISetOnEvent($GUI_EVENT_CLOSE,"OnExit")

GUISetState()

While 1

Sleep (1000)

$msg = GuiGetMsg()

If $msg = $GUI_EVENT_CLOSE

WEnd

Func OnExit()

if @GUI_CtrlId = $ExitId Then

Winclose("Mini Desktop")

Else

Winkill("Mini Desktop")

EndIf

Exit

EndFunc

When i disable Opt(GUIOnEventMode) and click on the Button "Exit" it does close but it fdoesnt close with the [X] Button of the window.

When i disable GuiGetMsg then i can close it with Exit button but not with the [X] of the window.

how do both work together ? With which code?

Tomorrow i can give more Detailed Informations with full Source Code.

Edited by Daniel W.

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites
cdkid

Try

instead of

While 1
Sleep (1000)
$msg = GuiGetMsg()
If $msg = $GUI_EVENT_CLOSE
WEnd

use

While 1
Sleep(10)
$msg = GuiGetMsg()
If $msg = $GUI_EVENT_CLOSE then
ExitLoop
WEnd

PS:

notice the neat little [code] tags

Edited by cdkid

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites
Valuater

with Opt("GUIOnEventMode", 1)

You dont use GuiGetMsg()

and i dont see a Button "Exit"

if there was a button you put GUICtrlSetOnEvent( -1,"OnExit") right below it

...also...

with GuiGetMsg()

you do not need to add a sleep()

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
Daniel W.

Yes k i didnt remembered whole code because i didnt had it there yesterday.

Tomorrow i will try it out.

Thank you for it.


--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.