0

I have a setup which installs my application (my application is just a hidden application that sync the data from my server to the users)...

When the setup start my application, the application exits when it finish! (it should not exit when it finish because the Timer will restart the functions again and again...)

The setup creator I use is InstallForge , I thought the problem is with InstallForge so I created another application that does Process.Start("MyApp.exe") but the same problem occurs too!

Opening the application exe manually is fine and the problem does not occur when I open it manually.

EDIT: My application does not have anything related to the closure of the application.

Here is how I hide my application:

Form_Load Event

Me.ShowInTaskbar = False
Me.Opacity = 0.0

Form_Shown Event

Me.Visible = False

Any help would be appreciated!

Thanks!

Mario
  • 1,374
  • 6
  • 22
  • 48

1 Answers1

0

Based on one of your questions here -> Disable exception errors ( .NET error messages / dialog ) and resume the code

If you are hiding the exception errors, please remove the code which hide them and you will see a "Invaild path" error then.

Application1: Is the application is trying to open your application.

Application2: Is your application.

If your application (Application2) have any line that try to start another exe file that is in the same folder of your application (Application2) ... it will throw an error and thus the application will exit.

So let's say that Application1 is in "C:\app1" , and Application2 is in "C:\app1\myapp" .

When Application1 do Process.Start("myapp\app.exe") it will start Application2 correctly ... but it is too late for Application2 to start another exe file which is in the same folder of it ! You know why? That because the working directory has already been set to "C:\app1" by Application1 , while Application2 must run what it want from "C:\app1\myapp" .

So simply the solution is to do that on Application2:

Add this:

Dim strPath As String = System.IO.Path.GetDirectoryName( _
    System.Reflection.Assembly.GetExecutingAssembly().CodeBase)

And now you can execute anything from Application2 by: Process.Start(strPath + "\startthis.exe")

Source: https://stackoverflow.com/a/2593490/6486232

Or You must put the files of Application2 in the same folder of the Application1 files.

Hope it helped! :)

protld
  • 418
  • 1
  • 5
  • 12