forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


@retcode() question

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
moke
Contributor
Contributor


Joined: 02 Jan 2002
Posts: 162

PostPosted: Thu Aug 22, 2002 1:24 pm    Post subject: @retcode() question Reply with quote

I usually don't use @retcode() mostly because the documentation on it says:

"This function returns the exit code (e.g. DOS errorlevel) of the last program executed using a RUN or SHELL command with a WAIT parameter."

and I don't use the wait parameter that often for Run or Shell. While doing some testing I found that the WAIT parameter may not be required to get a proper response. Can anyone confirm this?

Thanks,
moke
Back to top
View user's profile Send private message Send e-mail
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Thu Aug 22, 2002 1:53 pm    Post subject: Reply with quote

How could VDS know the return code of a program that has not even been finished executing
(so that the program couldn't have generated the return code yet either)?

Can it see in the future? Wink
Back to top
View user's profile Send private message Send e-mail Visit poster's website
moke
Contributor
Contributor


Joined: 02 Jan 2002
Posts: 162

PostPosted: Thu Aug 22, 2002 3:12 pm    Post subject: Reply with quote

Ouch! Smile I'm not really as stupid as I look, you know (it's not possible). Laughing

I think my question pertains more to commands with a yes or no answer. Did the command execute or not? For example;

Run worksheet.xls will return @retcode(0) as long as the file exists, has a file association and the action for the association is possible, even if excel has not finished loading the file. If excel has an error while loading the file the command has still been executed correctly.

Try this; rename a tif or bitmap to .xls and use RUN to open it. Excel will launch and @retcode() will be 0 but the file will generate an excel error which has nothing to do will @ retcode(). Since @retcode deals with system level codes (?), application specific errors don't necassarily effect it. So using wait in many cases does nothing.

So in some cases you can get the benefit of using @retcode() without making your app wait till the application window in question has been closed... I think Smile

Since I can barely spell V-D-S, nevermind use it, I thought some of the more knowledgable folks out there might be able to clarify this for me.

Thanks,

moke
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Thu Aug 22, 2002 3:51 pm    Post subject: Reply with quote

Hiya moke, Smile

The DOS errorlevel (or program exit code) doesn't get
set before the program exits (hence using the VDS WAIT
parameter).

The @retcode() function returns zero as a default, whether
you've ran a program or not. Wink


BTW, I don't think VDS is spelled with dashes either... Razz

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
moke
Contributor
Contributor


Joined: 02 Jan 2002
Posts: 162

PostPosted: Thu Aug 22, 2002 4:45 pm    Post subject: Reply with quote

Hey Mac,

OK... Then does that mean I can check to see if a error occured WHILE executing a command by looking for @retcode(-1), forgetting that the program itself may have had errors processing the request?

moke
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Thu Aug 22, 2002 4:55 pm    Post subject: Reply with quote

Prolly not unless the program exits on the error,
and ya'd still have to use WAIT to find out.

LOL, there's a reason it's called an EXIT code. It's
set when a program exits (closes), and ONLY then.

BTW, anything other than zero is usually an error,
HOWEVER, the programmer can use any exit code
he wants.

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
moke
Contributor
Contributor


Joined: 02 Jan 2002
Posts: 162

PostPosted: Thu Aug 22, 2002 5:48 pm    Post subject: Reply with quote

Actually, that's exactly what i'm looking for, did an error occur that caused the program to fail upon execution or did the operation fail completely. In which case, exit code 0, after a shell statement, would mean a success anything else would be failure to complete the command I think.

Thanks,

moke
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Thu Aug 22, 2002 6:14 pm    Post subject: Reply with quote

You can prolly use a slightly different approach to
check for a quick error exit and still not keep your
VDS program tied up.

Instead of using WAIT as a SHELL (or RUN) parameter,
put a WAIT 5 (or whatever) after the SHELL command,
then check @retcode(). This way your VDS program
can go on about its' business after a few seconds, and
@retcode() should catch the exit code if the app aborts
in that time frame.

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group