To Forcefully return Exit Code from an EXE (VB 6.0)
-
Hi friends..! My Problem is regarding Setup of my application which i am facing..is.. i want to check whether the product i am installing has been previously installed or not? i am using Install shield express edition for creating setup of mmy VB appplication. I am acertaining this with help of following function which is an API function defined in MSI.dll: "MsiQueryProductState(ProductCode)" Now when the function return me that there's an instance of the application i am installing what i want is...I want to forcefullly return the Exitcode from currently opened form. As i have learnt that .. it is the Exitcode which is responsible for the installer to proceed further after getting an exitcode '0' from the exe which it fires . I can get the install state of my application with the above function i.e. Whether it's already installed or not.. if it is already installed then i want the exe, which calls this function, to forcefully return an Exitcode '1' so that after getting Exitcode '1' the Parent Setup shud get terminated immediatley without going further. Thanx n Regards IPS IPS
-
Hi friends..! My Problem is regarding Setup of my application which i am facing..is.. i want to check whether the product i am installing has been previously installed or not? i am using Install shield express edition for creating setup of mmy VB appplication. I am acertaining this with help of following function which is an API function defined in MSI.dll: "MsiQueryProductState(ProductCode)" Now when the function return me that there's an instance of the application i am installing what i want is...I want to forcefullly return the Exitcode from currently opened form. As i have learnt that .. it is the Exitcode which is responsible for the installer to proceed further after getting an exitcode '0' from the exe which it fires . I can get the install state of my application with the above function i.e. Whether it's already installed or not.. if it is already installed then i want the exe, which calls this function, to forcefully return an Exitcode '1' so that after getting Exitcode '1' the Parent Setup shud get terminated immediatley without going further. Thanx n Regards IPS IPS
try Environment.Exit(exitCode)
topcoderjax - Remember, Google is your friend.
-
Hi friends..! My Problem is regarding Setup of my application which i am facing..is.. i want to check whether the product i am installing has been previously installed or not? i am using Install shield express edition for creating setup of mmy VB appplication. I am acertaining this with help of following function which is an API function defined in MSI.dll: "MsiQueryProductState(ProductCode)" Now when the function return me that there's an instance of the application i am installing what i want is...I want to forcefullly return the Exitcode from currently opened form. As i have learnt that .. it is the Exitcode which is responsible for the installer to proceed further after getting an exitcode '0' from the exe which it fires . I can get the install state of my application with the above function i.e. Whether it's already installed or not.. if it is already installed then i want the exe, which calls this function, to forcefully return an Exitcode '1' so that after getting Exitcode '1' the Parent Setup shud get terminated immediatley without going further. Thanx n Regards IPS IPS
VB6 doesn't have an Environment class, so you have to call into the Win32 API to set the exit code your you VB6 app before it exists:
Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)
.
.
. ' Somewhere in your code, just before it exits, do this...
ExitProcess somenumberBut, as with everything, there's always a catch[^].
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007