Administrators Jon Posted June 18, 2004 Administrators Posted June 18, 2004 GuiMsg() and GuiMsg(0) are pretty much the same now, but I noticed one difference: GuiMsg() automatically "shows" the gui when called but GuiMsg(0) doesn't (requires an explicit GuiShow()) Are there any issues with removing this difference? Or maybe GuiMsg() shouldn't automatically do the GuiShow()? Either way I can't think of a reason for them being any different now. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
pekster Posted June 18, 2004 Posted June 18, 2004 Do neither of them wait for a notify, or do both do that now? If I recall correctally, calling it with the 0 paramater used to test only for a change, so that you could run other code in the background, while a simple GuiMsg() would wait until there was a notify (so you would always get a non-zero back.) I guess I'm just confused as to what excatally has changed to make them no longer different. [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.
Administrators Jon Posted June 18, 2004 Author Administrators Posted June 18, 2004 pekster said: Do neither of them wait for a notify, or do both do that now? If I recall correctally, calling it with the 0 paramater used to test only for a change, so that you could run other code in the background, while a simple GuiMsg() would wait until there was a notify (so you would always get a non-zero back.) I guess I'm just confused as to what excatally has changed to make them no longer different.GuiMsg() only returns when something happensGuiMsg(0) returns instantly, with 0 if nothing has happened.If GuiMsg() is called while the GUI is hidden an automatic GuiShow() is done. GuiMsg(0) has never done this. The only reason there are two methods is you can use one of them to write non-blocking code so from my point of view they should be the same in all other ways. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
Holger Posted June 18, 2004 Posted June 18, 2004 (edited) Hmmm... I have all my scripts written to use GUIMsg() and GUIRead() and GUIMsg(0) (for loop-in-loops too), like this: GUICreate("test",100,100) $ani = GUISetControl("avi","Shell32.dll|150",20,20) $button = GUISetControl("button","START",20,70,70,20) GUISetControlNotify() While GUIMsg() $msg = GUIRead() If $msg = $button Then GUIWrite($button,0,"STOP") GUIWrite($ani,1) While 1 $msg2 = GUIMsg(0) If $msg2 = $button Then GUIWrite($ani,0) ExitLoop EndIf If $msg2 = -3 Then ExitLoop 2 WEnd GUIWrite($button,0,"START") EndIf $msg = -3 Then ExitLoop WEnd GUIDelete() So how can I check for a change in the second loop without stopping the script or is there something that I don't see? Edit: Ahhh...I see... I changed it to only GUIMsg() and GUIRead() and it works GUICreate("test",100,100) $ani = GUISetControl("avi","Shell32.dll|150",20,20) $button = GUISetControl("button","START",20,70,70,20) GUISetControlNotify() While GUIMsg() $msg = GUIRead() If $msg = $button Then GUIWrite($button,0,"STOP") GUIWrite($ani,1) While GUIMsg() $msg2 =GUIRead() If $msg2 = $button Then GUIWrite($ani,0) ExitLoop EndIf If $msg2 = -3 Then ExitLoop 2 WEnd GUIWrite($button,0,"START") EndIf $msg = -3 Then ExitLoop WEnd GUIDelete() Hmmm... Edited June 18, 2004 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
pekster Posted June 18, 2004 Posted June 18, 2004 Jon said: If GuiMsg() is called while the GUI is hidden an automatic GuiShow() is done. GuiMsg(0) has never done this. The only reason there are two methods is you can use one of them to write non-blocking code so from my point of view they should be the same in all other ways.Okay, now I get what you're saying. I would normally say to have neither one display the GUI automatically since we have an explicit GuiShow() call, but people might have written scripts assuming that GuiMsg() does display the GUI (such as the one above my post) that would break when the change is made. Because of this, prehaps it's best to have both display the GUI, if it's not already displayed through a seperate GuiShow() call. [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.
CyberSlug Posted June 19, 2004 Posted June 19, 2004 pekster said: I would normally say to have neither one display the GUI automatically since we have an explicit GuiShow() call, but people might have written scripts assuming that GuiMsg() does display the GUI (such as the one above my post) that would break when the change is made. Because of this, prehaps it's best to have both display the GUI, if it's not already displayed through a seperate GuiShow() call.Well, the GUI stuff is still beta, and bug fixes have broken some of my scripts already. I'd recommend making GuiMsg() not display the GUI automatically. Some people might have to add a GuiShow() statements to some scripts, but that's not hard.GuiMsg(0) should never display the GUI! I can invision a situations where you want to hide a GUI window but have GuiMsg(0) still running in the background... Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
pekster Posted June 19, 2004 Posted June 19, 2004 Good point CS. I guess that's one of the downsides to testing a beta. But I think you're right about uses for testing without showing a GUI. [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.
Administrators Jon Posted June 19, 2004 Author Administrators Posted June 19, 2004 Ok, assuming I remove the explicit GuiShow(), another point: There is a case when the gui is hidden and GuiMsg(0) is called it returns -2 to distinguish it from a usual 0 (no change). I could easily make it so that GuiMsg() also returns instantly with -2 if the Gui is hidden. My goal is so that you can take always take a GuiMsg() loop and change it to GuiMsg(0) without any differences so I think this will work. So to summarize - GuiMsg(0) and GuiMsg() to work in the same way - Both to instantly return -2 if the Gui is hidden at the time GuiMsg is called - No automatic GuiShow() Another change that some people will require is if they are doing a loop that ignores -3 (close) and relying on the fact that in the next iteration of the loop GuiMsg() would automatically show the gui again. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
jpm Posted June 20, 2004 Posted June 20, 2004 I am ok with the GuiShow not being implicit. I still like to have maximize/restore/minimize return not having a negative value. Easing the checking that the gui is close or hidden help the way the script can be design.
CyberSlug Posted June 21, 2004 Posted June 21, 2004 (edited) Speaking of GuiShow, could we add an optional parameter that makes GUI Active when displayed, such as GuiShow(1) ? EDIT: Well, the pre-existing optional parameter for timeout complicates this.... I dislike having to say:$title = "MyGuiTitle" GuiCreate($title, ...) ... GuiShow() WinActivate($title) Edited June 21, 2004 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Administrators Jon Posted June 21, 2004 Author Administrators Posted June 21, 2004 (edited) The flag for the initial gui display was SHOWNA (show not active). I did change this to the normal SHOW about a week ago which should be active on startup but then XP/2000 are bad at honoring this anyway. Edited June 21, 2004 by Jon Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
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