Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. To Forcefully return Exit Code from an EXE (VB 6.0)

To Forcefully return Exit Code from an EXE (VB 6.0)

Scheduled Pinned Locked Moved Visual Basic
helpjsonquestionworkspace
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    ips_sun
    wrote on last edited by
    #1

    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

    D D 2 Replies Last reply
    0
    • I ips_sun

      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

      D Offline
      D Offline
      Dave Herren
      wrote on last edited by
      #2

      try Environment.Exit(exitCode)

      topcoderjax - Remember, Google is your friend.

      1 Reply Last reply
      0
      • I ips_sun

        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

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        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 somenumber

        But, 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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups