Administrators Jon Posted June 8, 2004 Administrators Share Posted June 8, 2004 (edited) JP has expressed a wish to change the return values of GuiMsg to be less confusing. At the moment in my current unstable it returns positive and negative results both for "good" and "bad" events so you can't just do While GuiMsg() > 0 as other simple events (like maximizing/minimizing) give negative results. This doesn't bother me too much as I tend to use a Select statement anyway on the msg received rather than doing something like the above code. But if there is a popular opinion on how the return values could work better then we need to change it now. Due to the control ref now starting at 3 the values 1 and 2 could be used if required. Or we could have it so that serious events (timeout/closing by system menu) have negative numbers and other events (max/min) have massive numbers (higher than any possible control ref). Also I don't what the return values of GuiMsg(0) and GuiMsg() to be different (0 is used to indicated closed by button at the moment which conflicts with "no event" in GuiMsg(0) mode). I had changed my unstable so that it returned -3 if the gui was closed (by defined button OR close menu) but this could also cause confusion. Edited June 8, 2004 by Jon Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
SlimShady Posted June 8, 2004 Share Posted June 8, 2004 FYI: I use this and it works exactly like I want it to work. $msg = GUIMsg(0) While $msg <> -3 $msg = GUIMsg(0) ;.... some code ........ WEnd Link to comment Share on other sites More sharing options...
Lazycat Posted June 8, 2004 Share Posted June 8, 2004 (edited) I have no probs with previous (all negative) return values, but if they are must to change, I vote for second case (nagative and/or big positive). Although this is not principle, IMO more logical when control refs start from 1. And I also agree that better if GuiMsg(0) and GuiMsg() will have identical return codes. 0 for no events and -3 for close are good enough. Edited June 8, 2004 by Kot Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
Administrators Jon Posted June 9, 2004 Author Administrators Share Posted June 9, 2004 (edited) Ok, not much feedback so I'll assume that there isn't actually a problem with the current implementation. Both GuiMsg() and GuiMsg(0) to use the same values (except GuiMsg(0) will return 0 for no event but GuiMsg() will no longer use 0 as a return so the two should be interchangable) Return values will be: 0 = no event ( GuiMsg(0) only) -1 = timeout -2 = unknown - JP/Valik what is this for at the moment - unclear from source -3 = closed (either by defined button or by system menu) -4 = minimized -5 = restored -6 = maximized Not at all sure what -2 is used for. The control refs should be like other handles and be "undefined" - so code like: While GuiMsg() >0 is a no-no. I could alter the code so the refs are adjusted to start from 1 but if they are undefined then this is not requried The only oddidty is that you can't tell if the gui was closed by a defined button or by a system menu (both return -3) although if you need to you can use GuiRead() to find the last clicked button if you care. Seems OK to me. Edited June 9, 2004 by Jon Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Valik Posted June 9, 2004 Share Posted June 9, 2004 The help file for GuiMsg() says:Hidden: -2 dialog box is in hidden state due to click on a button defined by GuiSetControlNotify.I have never used that return for anything, though. Link to comment Share on other sites More sharing options...
jpm Posted June 9, 2004 Share Posted June 9, 2004 In the code I first did: if a GuiHide() was executed, the next GuiMsg(0) was returning -2 indicating that the gui is no more open. That's has been removed in Jon code. I am not for sure how the new code has to react to this sequence of gui function. Link to comment Share on other sites More sharing options...
Administrators Jon Posted June 10, 2004 Author Administrators Share Posted June 10, 2004 (edited) In the code I first did:if a GuiHide() was executed, the next GuiMsg(0) was returning -2 indicating that the gui is no more open.That's has been removed in Jon code. I am not for sure how the new code has to react to this sequence of gui function. I can add this now I know what it is. But should GuiMsg return -2 just the once followed by 0s or keep returning -2 as long as it is hidden? Edited June 10, 2004 by Jon Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
jpm Posted June 10, 2004 Share Posted June 10, 2004 I can add this now I know what it is. But should GuiMsg return -2 just the once followed by 0s or keep returning -2 as long as it is hidden?it looks like you put the code in GuiMsg perhaps is not workingSorry for the misinterpretation of the code move from hide to guimsg Link to comment Share on other sites More sharing options...
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