Process.StandardInput.WriteLine not working under Vista?

S

SurturZ

The following code used to work. It starts up notepad and types a few lines.
What am I doing wrong? I'm using VB.NET 2005 under Vista. It starts notepad
okay, but it can't 'type' into it.


'demonstrate "typing" into notepad
Dim psiProcessStartInfo As New ProcessStartInfo
With psiProcessStartInfo
.Arguments = "" 'command line arguments
.CreateNoWindow = False
.ErrorDialog = False
.FileName = "notepad.exe"
.LoadUserProfile = False
.RedirectStandardError = False
.RedirectStandardInput = True
.RedirectStandardOutput = False
.UseShellExecute = False 'this must be false for
input/output/error redirection
.WorkingDirectory = ""
End With
Using prc As Process = Process.Start(psiProcessStartInfo)
MsgBox("")
prc.StandardInput.WriteLine("This line added by ProcessMgmtDemo")
prc.StandardInput.WriteLine("This line added by ProcessMgmtDemo")
prc.StandardInput.WriteLine("This line added by ProcessMgmtDemo")
End Using
 
R

rowe_newsgroups

The following code used to work. It starts up notepad and types a few lines.
What am I doing wrong? I'm using VB.NET 2005 under Vista. It starts notepad
okay, but it can't 'type' into it.

        'demonstrate "typing" into notepad
        Dim psiProcessStartInfo As New ProcessStartInfo
        With psiProcessStartInfo
            .Arguments = "" 'command line arguments
            .CreateNoWindow = False
            .ErrorDialog = False
            .FileName = "notepad.exe"
            .LoadUserProfile = False
            .RedirectStandardError = False
            .RedirectStandardInput = True
            .RedirectStandardOutput = False
            .UseShellExecute = False 'this must be false for
input/output/error redirection
            .WorkingDirectory = ""
        End With
        Using prc As Process = Process.Start(psiProcessStartInfo)
            MsgBox("")
            prc.StandardInput.WriteLine("This line added by ProcessMgmtDemo")
            prc.StandardInput.WriteLine("This line added by ProcessMgmtDemo")
            prc.StandardInput.WriteLine("This line added by ProcessMgmtDemo")
        End Using

Why are you trying to open and manipulate Notepad instead of just
writing to a file and then opening it in Notepad?

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
 

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