Question

Windows 7 (64 bits); VB in VS2008 (WOW); .NET 3.51

 Dim MyProcess As New System.Diagnostics.Process()

 MyProcess.StartInfo.FileName = My.Resources.TARGET
 MyProcess.Start() 'everything is copacetic to here
 MyProcess.WaitForExit 'likewise if TARGET is a text file name,
                       'but not for URLs 

When the TARGET is a URL, Start correctly launches the default browser (the UI of which does exactly what is expected), but WaitForExit throws this exception:

enter image description here

 MyProcess.Close()  'fine for Notepad, never arrives here if IE or Firefox.

I haven't tested this much: I will check out other methods/properties of Process and report back. The code works fine with Notepad (and I gather from SO and other sites, with many other EXEs) and fails with both Firefox and IE. Why?

Ideas? Am I barking up the wrong tree?

Était-ce utile?

La solution

Try setting StartInfo.FileName to iexplore.exe and start info arguments to the URL.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top