|
-
Feb 3rd, 2003, 08:48 AM
#1
Thread Starter
Lively Member
return value of EXE
I am developing an EXE (type: Windows Application) in VB.NET. This EXE is called by an external program. But unfortunately it is necessary to return a value to that external program. Is there a possibility to do so? If yes, how?
-
Feb 3rd, 2003, 09:10 AM
#2
Although I have never used it before, the System.Environment class has an Exit method which has a parameter to set the exit code for the process. If the other application is developed in a .NET language as well, you can use the ExitCode property of the System.Diagnostics.Process class to read it. If the other application is not developed in a .NET language, you can use the GetExitCodeProcess API function.
-
Feb 3rd, 2003, 10:18 AM
#3
Thread Starter
Lively Member
Thanks.
It seems to be so easy; but it isn't.
This is my code (a very short version):
Code:
Sub Main()
Dim args() As String
Dim i As Integer
Dim blnOK As Boolean = True
args = Environment.GetCommandLineArgs
If args.Length > 1 Then
mudtArgs = New EingabeParameter()
For i = 1 To args.Length - 1
MsgBox("Args(" & i & ") = " & args(i))
Next
End If
Environment.Exit(42)
End Sub
The calling application is no .NET written application. But it does use the GetExitCodeProcess API function and all I get (in a MsgBox) is 0. Any idea?
-
Feb 3rd, 2003, 10:24 AM
#4
Sleep mode
Originally posted by Frans C
Although I have never used it before, the System.Environment class has an Exit method which has a parameter to set the exit code for the process. If the other application is developed in a .NET language as well, you can use the ExitCode property of the System.Diagnostics.Process class to read it. If the other application is not developed in a .NET language, you can use the GetExitCodeProcess API function.
I'don't think ExitCode Porperty would do this .It's job only to get the result of an exiting an extrenal app .Zero successful , non-zero results in error .
-
Feb 3rd, 2003, 10:50 AM
#5
Like I said, I have never used it before.
If it doesn't work, I'm afraid I can't help you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|