Solved

Returning an error code from a command-line driven program

Posted on 2006-06-16
3
133 Views
Last Modified: 2010-04-05
Hi, I have written a simple exe that the user calls from the command line with various parameters. I can display messages if things go wrong, but some customers want error codes returned so that they can integrate it into their applications. But I am unsure how to do this. This is a windows application written in Delphi 7. I want to return a 0 or 1 etc.

Many thanks.
Gary
0
Comment
Question by:GaryHandley
3 Comments
 
LVL 10

Accepted Solution

by:
atul_parmar earned 100 total points
ID: 16918890
Just set ExitCode before you quit/terminate your application
e.g.
ExitCode := 1;
0
 
LVL 4

Assisted Solution

by:David_Ward
David_Ward earned 25 total points
ID: 16919312
Halt(0);
Halt(1);

... Halt(254) ... etc
0
 

Author Comment

by:GaryHandley
ID: 16919730
Many thanks, I knew it had to be something simple, but it was eluding me :-) Both solutions are useful, thanks.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now