On Windows Vista, Process.Start() generates Win32Exception.

A

Atara

On Windows Vista, Process.Start() generates Win32Exception.

Sample Code:

Dim selfProc As String = System.Windows.Forms.Application.ExecutablePath
System.Diagnostics.Process.Start(Chr(34) & selfProc & Chr(34))


The generated Exception:

System.ComponentModel.Win32Exception: The parameter is incorrect
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo
startInfo))
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)
at ...MyProcedure(...)


What is wrong with my code?

Thanks


Atara
 
P

Patrice

Are you sure you need quotes ? (executable and arguments are provided
separately unlike when typing in the console).
 
A

Atara

I had the same error , when not having the chr(34), so I added it.

Do you think that this might cause the problem?



while googling, I found Microsoft Process Monitor , I will try to use it
during this week.

Do you think I need to set
Process.StartInfo.UseShellExecute = False
???

Thanks

Atara
 
P

Patrice

Would say a problem with the target file. Do you have the same problem when
try to launch some other EXE file such as calc.exe ?

What kindf of file are you trying to launch ? For executable and unless you
want to use redirection it shouldn't make any difference.

Finally it could be perhaps something with Vista new security featrures (UAC
or hgher privileged directory ?)

For now I would make a test with calc.exe to see if it works for something
simple...

Good luck.
 
A

Atara

sorry I did not answer before, busy with other projects.
I hope to update this thread when I have new info

Thank you all.

Atara.
 
A

Atara

I started investigating the problem...

I get the same error in two cases:
1. When I try to re-execute my application.
2. When I try to open an html file in the default browser.

regardind the 2nd case, I added
Catch ex1 As System.ComponentModel.Win32Exception

and I get
ex1.ErrorCode().ToString => [-2147467259]
ex1.NativeErrorCode().ToString => [87]

according to [url:http://support.microsoft.com/kb/305703]
... if you use this approach on a computer that does not have a
browser installed, an exception occurs. ...

so my question now is:
How to start the default Internet browser on Vista ?

Atara
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top