shragi
asked on
exitprocess using kernel32
In my program I used to use the below function
Call ExitProcess(retVal)
here retval is long and I declared exitprocess as below
Private Declare Sub ExitProcess Lib "KERNEL32" _
(ByVal uExitCode As Long)
but now i want to return string, i made the same call
Call ExitProcess(retVal)
but my decalration is different
Private Declare Sub ExitProcess Lib "KERNEL32" (ByVal uExitCode As String)
is this correct ? can i use it in this way...because i heard we can just have uExitCOde as Long.
Call ExitProcess(retVal)
here retval is long and I declared exitprocess as below
Private Declare Sub ExitProcess Lib "KERNEL32" _
(ByVal uExitCode As Long)
but now i want to return string, i made the same call
Call ExitProcess(retVal)
but my decalration is different
Private Declare Sub ExitProcess Lib "KERNEL32" (ByVal uExitCode As String)
is this correct ? can i use it in this way...because i heard we can just have uExitCOde as Long.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Private Declare Sub ExitProcess Lib "KERNEL32" (ByVal uExitCode As String)
is this possible or not...
can the API take string if not is there any other options i have
is this possible or not...
can the API take string if not is there any other options i have
No...it takes an Integer:
Private Declare Sub ExitProcess Lib "KERNEL32" (ByVal uExitCode As Integer)
*Not necessary though as I pointed out previously.
What are you trying to do?...
Private Declare Sub ExitProcess Lib "KERNEL32" (ByVal uExitCode As Integer)
*Not necessary though as I pointed out previously.
What are you trying to do?...
I think @kaufmed gave you the correct answer already. Operating system exit codes are inherently numeric by nature, for now (No, you won't be able to return a string). You can try writing the string to the standard out before exit, and any monitoring processes might be able to catch/parse that. But for now you are limited to using Integer or Long. That is not to say that you couldn't have a specific meaning reserved for each numeric value. Typically, processes return 0(zero) when successful, and !0 (not zero) otherwise.
Input parameter can be long or string,since you need to return a string you can keep like this.
Private Declare Sub ExitProcess Lib "KERNEL32" _
(ByVal uExitCode As Long)
-
-
string x=uExitCode.tostring()
end sub