0

I'm somewhat new to VB.NET so I came here to ask a question. I'm making a custom installer which launches 'setup.exe' located in local directory and it was created by Visual Studio's "Publish" function. I want my WindowsFormApplication to get the 'Yes or No' result from the 'setup.exe' and if it is yes, it will enable button1 and if No, it will show a MsgBox telling "Process cancelled by user. I've researched a lot on the internet which only tells how to get YesorNo result from the MsgBox and do some action. I tried this:

 Dim result As Integer = Process.Start("setup.exe")
   If result = Result.No Then
       MessageBox.Show("Process Cancelled by user")
   ElseIf result = Result.Yes Then
       Button1.Enabled = True
   End If
Shahroz Asif
  • 143
  • 1
  • 10
  • The setup.exe produced by 'Publish' is intended for use as a ClickOnce installer. The setup.exe produced by a deployment project, either ISLE or [the extension](https://visualstudiogallery.msdn.microsoft.com/f1cc3f3e-c300-40a7-8797-c509fb8933b9) includes a cancel button. – peterG May 14 '16 at 19:21
  • Thanks but I have already installed "Microsoft Visual Studio 2015 Installer Projects". f this method is not possible with the setup.exe produced by Visual Studio, is there any alternative way of doing it? – Shahroz Asif May 17 '16 at 17:07
  • I'm not sure what you're trying to do, tbh, but I think [this question](http://stackoverflow.com/questions/1585354/get-return-value-from-process) might be what you're looking for. – peterG May 17 '16 at 19:15

1 Answers1

0

You should read this;

https://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.redirectstandardoutput(v=vs.110).aspx

You have to wait for the process to exit, but it all depends what setup.exe is generating for output...

Dennis
  • 1,528
  • 2
  • 16
  • 31
  • But it just waits for the exit and doesn't get results. The exit can be either sides, If Yes is clicked, Setup.exe will install application and close and if No clicked, Setup.exe will simply close. The code tells what to do if the program is closed. – Shahroz Asif May 14 '16 at 10:32
  • That's what I said, and what you probably don't want to hear; it al depends on what output this setup.exe creates. There is no easy way to catch what happens in an other program if the other program doesn't give any output. So you can, decompile or/and recreate this setup.exe, which is very hard. Apparently your setup.exe doesn't generate any output. Look, you're starting a process, and you want to see if something is installed afterwards, you could get the list of installed programs after the setup has finished from the registry and enable your button if it is installed. – Dennis May 14 '16 at 10:58
  • Is there a way we can create something similar like setup.exe which will install the program and give an output? – Shahroz Asif May 14 '16 at 12:42