#166889 - 2006-09-05 10:30 PM
KiX 4.53 RC1, MessageBox: Error Code = Return Value
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
I would think if MessageBox was used correct, it would give error 0 Code:
If NOT @LOGONMODE Break ON EndIf Dim $SO $SO = SetOption("Explicit","On") $SO = SetOption("NoMacrosInStrings","On") $SO = SetOption("NoVarsInStrings","On") $SO = SetOption("WrapAtEOL","On")
$SO = MessageBox("Hello World","My First KiX Script") ? "Return Value: " + $SO ? "Error " + @ERROR + ": " + @SERROR ? "Kix Version: " + @KIX Shows on screen: Code:
Return Value: 1 Error 1: Onjuiste functie. Kix Version: 4.53 Release Candidate 1
|
Top
|
|
|
|
#166899 - 2006-09-06 09:58 AM
Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
IMHO, the @Error does not have to be documented for MessageBox seperately. It is all in Appendix B. @Error must just follow the Error codes as listed on the Microsoft Developer Network: System Error Codes .
|
Top
|
|
|
|
#166901 - 2006-09-06 01:00 PM
Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Indeed. In that case you will want to be doing something about Get as well
|
Top
|
|
|
|
#166902 - 2006-09-06 01:58 PM
Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Good point. I read it. But this is IMHO a good workaround to catch special keys.
About Get: I think it could be stored in the Return Value, but it should be recognisable. p.e. change the type that is outputted to an Array. Store in place 0 the Value Store in place 1 the KeyCode Code:
Get $SO /A ? "Key: " + $SO[0] ? "KeyCode: " + $SO[1]
If $SO[0] = "" then you know a special key was pressed
$SO[1] p.e. an "A" on a French, Belgian(, Canadian?) keyboard will return the same KeyCode as a "Q" on almost any other keyboard in the world.
/A could be a switch to make Get work in Advanced mode, for downward compatibility
I do not know if that makes sense...
About MessageBox The Error Code for MessageBox does not give me any added value. Error Code = Return Value Return Value = Error Code It only gave me surprising error values at places in scripts where I did not expect to catch one.
Edited by Witto (2006-09-06 02:12 PM)
|
Top
|
|
|
|
#166904 - 2006-09-06 03:14 PM
Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
About MessageBox:
- I think checking @ERROR or checking the Return Value for totally the same *value* does not require big recoding.
- I would also think that most coders would use the return value to check what key is pressed in MessageBox. Just as it is documented.
Or wait, maybe this: MESSAGEBOX ("message", "title", style, time-out, 1) A fifth optional parameter to indicate you want real Error Codes? Default = 0?
About Get: It is just because you came up with it that I just started thinking about a suggestion with downwards compatibility.
|
Top
|
|
|
|
#166905 - 2006-09-06 03:16 PM
Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
BTW, Thanks for pulling my leg, I liked it.
|
Top
|
|
|
|
#166908 - 2006-09-06 04:35 PM
Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Quote:
"Will" sounds so certain. I would prefer to say "might" since I doubt may people actually work with the @Error returned by MessageBox()
I actually had "could" at first but "could" or "might" implies a very small chance that any script will break. However given the amount of scripts that are out there it is actually very likely that a change is going to break a number. It's also very likely that it will be a very small number.
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 286 anonymous users online.
|
|
|