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 


vds program that returns a return code

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


Joined: 19 May 2009
Posts: 20

PostPosted: Thu Oct 15, 2009 10:25 pm    Post subject: vds program that returns a return code Reply with quote

How can I write a vds program that will return a DOS return code?
For example, when the program completes successfully it will return 0 else it will return 1.
Back to top
View user's profile Send private message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Fri Oct 16, 2009 1:38 am    Post subject: Reply with quote

I think there was a "vdsconsole" DLL for this, but it might also be a native functionality in the latest VDS release (I never used that one).

Hope this helps. Smile

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Fri Oct 16, 2009 11:47 pm    Post subject: Reply with quote

You can use the ExitProcess kernel32.dll API function.

Code:

:CLOSE
  LoadLib kernel32.dll
  %%errorlevel = 255
  %R = @lib(kernel32,ExitProcess,NIL:,INT:%%errorlevel)
Exit

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Sat Oct 17, 2009 11:39 pm    Post subject: Reply with quote

In VDS look at @RETCODE in the helpfile.

From the helpfile

Code:
RUN PKZIP.EXE

info Return code was @retcode()


Or, what about using the pipe option

Code:
runh cmd /C set,pipe
info @pipe()
Back to top
View user's profile Send private message Send e-mail
dangt
Newbie


Joined: 19 May 2009
Posts: 20

PostPosted: Mon Oct 19, 2009 3:11 pm    Post subject: Reply with quote

Thanks dragonsphere! That would work.
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Oct 19, 2009 3:57 pm    Post subject: Reply with quote

Aslan wrote:
In VDS look at @RETCODE in the helpfile.

From the helpfile

Code:
RUN PKZIP.EXE

info Return code was @retcode()


Or, what about using the pipe option

Code:
runh cmd /C set,pipe
info @pipe()


Actually dangt was wanting a VDS program to return a errorlevel to an external program not capture an external program's errorlevel. Wink

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Wed Oct 21, 2009 12:26 am    Post subject: Reply with quote

Thanks for the clarification Smile

I knew I should have worn my glasses when I read dangt's post.....
Back to top
View user's profile Send private message Send e-mail
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Sun Oct 25, 2009 6:04 am    Post subject: Reply with quote

When I run that code it closes the VDS IDE. Is this normal?

Does the ExitProcess kernel32.dll API function also close the application?

I assume that because the ExitProcess function ends a process and all its threads, and VDS only has a single thread, that calling ExitProcess will stop the application... but why does it also close the IDE.

_________________
cheers

Dave
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Oct 26, 2009 12:20 pm    Post subject: Reply with quote

Are you running the script in the VDS IDE? If so then yes that is what it is supposed to do. When you click on the run button (green) in the VDS IDE it is VDS that is running the script not your compiled EXE which would be the red run button. When you have direct access to the executables MAIN function you could just simply give it a value to return however DLL's and other components such as ActiveX don't have direct access to the EXE's MAIN function so they (M$) invented ExitProcess for this reason.
_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Tue Oct 27, 2009 8:43 am    Post subject: Reply with quote

vdsalchemist wrote:
Are you running the script in the VDS IDE?

Yes

vdsalchemist wrote:
If so then yes that is what it is supposed to do.

Thanks

_________________
cheers

Dave
Back to top
View user's profile Send private message
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