my code doesnt execute to the end of the function, and doesnt return any error...

  • Thread starter Thread starter Milsnips
  • Start date Start date
M

Milsnips

Hi there,

i've created a STARTER program that checks if a cab file exists on the pda,
if so, it installs it, waits until the process exits, then deletes the cab
file if exists and call a new process to start my updated application.

Code is below:

Public AppPath As String =
System.IO.Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)

Sub Main()
Dim p As Process
If IO.File.Exists("\My Documents\setup.cab") Then
p = New Process
p = Process.Start("\My Documents\setup.cab", "")
p.WaitForExit()
p.Kill()
p = Nothing

If IO.File.Exists("\My Documents\setup.cab") Then
IO.File.Delete("\My Documents\setup.cab")
End If
End If

If IO.File.Exists(AppPath & "\myApp.exe") Then Process.Start(AppPath &
"\myApp.exe", "")

End Sub

Ok, here is the scenario where i think the problem is occuring, if the cab
file doesnt exist, it skips the first IF statement and loads MyApp.exe okay.
However... if the setup file does exist, it starts the process, and during
the installation, the connection is lost during debug, and although the
setup continues until the end, the rest of the code doesnt execute,
therefore it doesnt restart my update MyApp.exe application file.

Please any help appreciated into why it cuts out during the cab file install
process if anyone knows, and a workaround to this problem would br great!

thanks,
Paul
 
comment out the line p.Kill() and see if that fixes it. Just seemed
odd to call kill after waiting for the process to terminate.
 
Hi there,

sorry the p.Kill i accidentally forgot to comment it out before posting, i
just added it recently to see if it made any difference, but it doesnt, so
my problem still occurs.

regards,
Paul
 
Problem now solved,

i replaced the original Process.Start line with the following:

p = Process.Start("\Windows\wceload.exe", "/noaskdest /noui ""\My
Documents\setup.CAB""")

regards,
Paul
 
Back
Top