INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How to Raise Exception from a ShellExecuted Delphi program into the Parent Delphi program

How to Raise Exception from a ShellExecuted Delphi program into the Parent Delphi program

How to Raise Exception from a ShellExecuted Delphi program into the Parent Delphi program

(OP)
I have a Delphi program, A, which runs another Delphi program, B, using CreateProcess (or ShellExecute)

The return code from CreateProcess merely indicates whether the process was successfully created so it is useless when trying to RAISE ERRORS.

The only way I can think of doing it is to have B create a file with an error message ON Exception.

When A detects that the B process is finished, go and look for the B error file, read the error and then RAISE an error with the appropriate E.message.

HOWEVER, There simply has to be an elegant way to do this since this should be a common occurrence.

Thanks in advance,
Tom



RE: How to Raise Exception from a ShellExecuted Delphi program into the Parent Delphi program

Check out ErrorLevel (yup, that same one you once used in batch files :))

RE: How to Raise Exception from a ShellExecuted Delphi program into the Parent Delphi program

(OP)
Hi, Thanks for the ErrorLevel suggestion.

However, I'm not sure exactly how it works:

1) Does it report the Last Error any process incurred? If Yes, you would not know when that error occurred - it could have been from hours or days ago.

2) OR, Does it report the Error of the last process to terminate? If Yes, does this include all system and other processes? Further, there could be many system processes that terminate AFTER the Delphi B program terminated.

Just thinking... When you CreateProcess, you get the Process Handle. Is there any way to see how a particular process terminated?

Thanks
Tom

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close