Shell and re-directed input 
Author Message
 Shell and re-directed input

Hi,

I am trying to execute an MS-fortran .exe file from within a VB5
program.  The FORTRAN program asks for input from the user via the
keyboard.

If I do this:

Private Sub ses_Click()

    Dim ProcID As Double

    ProcID = Shell("d:\joho\mvs\programs\ses.exe ", vbNormalFocus)

End Sub

the program works perfectly fine in a DOS window that opens, gets the
input from the keyboard, and closes, returning control back to VB.

If I open a DOS window and enter this:

d:\joho\mvs\programs\ses.exe <f:\mvs\working\ses.inp

where the ses.inp file contains the input, the program runs fine,
getting the input from the ses.inp file instead of the keyboard, and
ends normally. Normal DOS behavior.

If I add the re-direction to the VB like this:

Private Sub ses_Click()
    Dim ProcID As Double

    ProcID = Shell("d:\joho\mvs\programs\ses.exe
<f:\mvs\working\ses.inp", vbNormalFocus)

End Sub

then the ses program behaves as if the input file specification wasn't
there (like the original case).  There is a space between the .exe and
the "<". It doesn't seem to understand that the input has been
re-directed.

Any idea what it is that I'm missing?

I appreciate the help.

--
Duncan



Tue, 10 Oct 2000 03:00:00 GMT  
 Shell and re-directed input


Quote:

>Hi,

>I am trying to execute an MS-FORTRAN .exe file from within a VB5
>program.  The FORTRAN program asks for input from the user via the
>keyboard.

>If I do this:
>...
>the program works perfectly fine in a DOS window that opens, gets the
>input from the keyboard, and closes, returning control back to VB.
>...
>If I add the re-direction to the VB like this:

>Private Sub ses_Click()
>    Dim ProcID As Double

>    ProcID = Shell("d:\joho\mvs\programs\ses.exe
><f:\mvs\working\ses.inp", vbNormalFocus)

>End Sub

>then the ses program behaves as if the input file specification wasn't

I think that the problem is that redirection is a function of the command
interpreter not of the shell function.  

You could try shelling the command.com program (or whatever it is called in
NT/95) and passing your command line to it:

    shell("command.com -c d:\joho\mvs\programs\ses.exe
<f:\mvs\working\ses.inp", vbNormalFocus)

I'd be interested to know if it works.

--
Kevin Whitefoot, IT Centre, ABB Kraft AS, Drammen, Norway.



Mon, 30 Oct 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help in Redirecting Standard Input

2. Serial input redirecting!

3. Getting Redirected Keyboard Input

4. Detecting Duplicate Entries On Direct Input

5. direct input vs BCP

6. Direct Input in VB 5 from Soundblaster live

7. getting a direct input from excel table

8. Direct Input : Action Mapper

9. Direct Input problem

10. direct input error

11. Knowing program input while using Direct Draw 7.

12. Direct Input :: Foot Pedal Axis question

 

 
Powered by phpBB® Forum Software