Page 1 of 1 1
Topic Options
#166930 - 2006-09-06 08:49 AM KiX 4.53 RC1, MessageBox: Error Code = Return Value
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
If MessageBox was used correct, it should give error 0.
But now, the error code is the same as the return value.
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
#166931 - 2006-09-06 09:11 AM Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
witto, did you try this with other versions also?
Top
#166932 - 2006-09-06 10:12 AM Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Code:

Return Value: 1
Error 1: Onjuiste functie.
Kix Version: 4.52


Code:

Return Value: 1
Error 1: Onjuiste functie.
Kix Version: 4.52 Release Candidate 1


Code:

Return Value: 1
Error 1: Onjuiste functie.
Kix Version: 4.52 Beta 2


Code:

Return Value: 1
Error 1: Onjuiste functie.
Kix Version: 4.52 Beta 1


Code:

Return Value: 1
Error 1: Onjuiste functie.
Kix Version: 4.51


Code:

Return Value: 1
Error 1: Onjuiste functie.
Kix Version: 4.50


Top
#166933 - 2006-09-06 10:30 AM Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, what about 4.02 as example?
just thinking. if this is a long standing issue, I can understand the move to suggestions.
if this is relatively new one, then it should be in beta.

Top
#166934 - 2006-09-06 10:48 AM Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Code:

Return Value: 1
Error 1: Onjuiste functie.
Kix Version: 4.23


Code:

Return Value: 1
Error 1: Onjuiste functie.
Kix Version: 4.12


Code:

Return Value: 1
Error 1: Onjuiste functie.
Kix Version: 4.02


Top
#166935 - 2006-09-07 05:32 PM Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
What about
MessageBox("Message", "Title"[, Style, Time-Out, RealErrors])
A fifth optional parameter to indicate you want real Error Codes?
A boolean telling False or True.
Default = 0 (or False)
Real Errors = 1 (or -1 or True)

Top
#166936 - 2006-09-07 09:06 PM Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Well not to rain on your parade, but I have a question.

IF MessageBox has a failure wouldn't that mean that all the other functionality of KiX would be in question as well?

I mean, MessageBox is a native operation of KiXtart so if it won't launch or doesn't run properly I would think that the failure code would be of little value since KiXtart itself is not operating correctly on the given system.

OR - Did you mean that if you wrote the MessageBox wrong that you want a specific error message on screen? Which I think it already does do.

Top
#166937 - 2006-09-07 09:50 PM Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
doc, but error code is error code.
setting it when there is no error is just plain wrong.

Top
#166938 - 2006-09-07 11:40 PM Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Thanks Jooel. I was surprised to catch error codes in my script where I did not expect them. It is not documented that the return value and the error code for MessageBox are the same. I think it would be much better to get return values where you expect them. Always.
OK, maybe the error code from MessageBox is of little value. But if I use code afterwards (UDF?) that does not set errors as it should, I do catch errors where I did not want to catch them.
As Jooel says, error is error.

Top
#166939 - 2006-09-07 11:59 PM Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Okay, I can agree with that.

Actually Shawn ran into that with some code I had written a while back. His code had generated an error which my code did not expect and it caused mine to fail. I had to modify my code to be able to anticipate a possible pre-error condition (didn't have to but made it a bit better code by doing so)

Top
#166940 - 2006-09-08 12:22 AM Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I guess you guys don't heed my warnings. I've been telling people about being optimistic about @Error for years.
Top
#166941 - 2006-09-08 12:47 AM Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Les,
I read your post in the FAQ & How to's: EXIT [error level / exit code] optional or not?
But there, you also say about providing an error code for Exit:
Quote:

When providing the parm, one should try to remain true to the meaning of the EXIT code.



Top
#166942 - 2006-09-08 01:01 AM Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You are preaching to the choir. I agree that MessageBox() should not throw the return code as @Error. As Jooel said, "setting it when there is no error is just plain wrong".
Top
#166943 - 2006-09-08 01:05 AM Re: KiX 4.53 RC1, MessageBox: Error Code = Return Value
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
OK, Thanks.
Top
Page 1 of 1 1


Moderator:  Lonkero, ShaneEP, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1739 anonymous users online.
Newest Members
min_seow, Audio, Hoschi, Comet, rrosell
17881 Registered Users

Generated in 0.063 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org