Will Will - 1 year ago 85
Bash Question

If I call Shell Foo.exe from a VB6 program, and Foo.exe flames out, will my VB6 program flame out too?

I am once again forced to update an archaic vb6 program for reasons that make me want to fling myself into traffic.

I have written a bare bones .Net application that is to be Shelled by the VB6 program under certain circumstances.

Because the .Net program runs in .Net 4.5.2, and my VB6 IDE is on a Windows XP system ( kill me please ), I fully expect it ( the .Net application ) to crash in glorious fashion when the VB6 program calls it to run in the development environment.

Unfortunately that's not happening - what is happening is I am getting a runtime error 5.

This is the call VB6 should be making -

Shell """" & App.Path & "\Foo.exe"""

That's it. The .Net program in question is a lookless application ( no ui, no console, and that's how it's supposed to be ), whereas the VB6 program has a GUI and makes me want to take up casual alcoholism as a hobby.

The only thing that I can think of is the called program flaming out makes VB6 throw a fit - is that hypothesis correct? If not, what else could be the problem?

Answer Source

VB6 Shell command will raise a runtime error 5 if it can't start the program specified. If that runtime error is unhandled then your program will halt with a standard VB6 error message for that error. As stated in the comments the OP's .NET EXE can't be launched on Windows XP (maybe it was built for x64?) so they are getting this error.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download