PC Review


Reply
Thread Tools Rate Thread

Strange console behavior

 
 
Tobias Weltner [MVP]
Guest
Posts: n/a
 
      5th Apr 2006
I just tried to create a redirected console. Works BUT when I launch
external apps with GUI (not console apps), they remain invisible and prevent
my app from closing (it stays in the task manager list). When I kill it, all
launched invible apps turn visible.

Anyone a clue????

Here's the .NET 2.0 code:

ublic Class Form1

WithEvents p As Process

Private Declare Function AllocConsole Lib "kernel32" () As Integer

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

InitHost()

End Sub

Sub InitHost()

AllocConsole()

Dim psi As ProcessStartInfo = New ProcessStartInfo

psi.FileName = "cmd.exe"

psi.UseShellExecute = False

psi.RedirectStandardInput = True

psi.RedirectStandardOutput = True


p = Process.Start(psi)

p.StandardInput.WriteLine("notepad.exe")

p.StandardInput.WriteLine("notepad.exe")

p.StandardInput.WriteLine("notepad.exe")

p.StandardOutput.ReadToEnd()

p.WaitForExit()

End Sub

End Class


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help: Strange, Strange Behavior ( Not Me. My Model! ) SteveM Microsoft Excel Programming 2 16th Dec 2007 07:02 PM
VS 2005 Win 32 Console Project Behavior pvdg42 Microsoft VC .NET 7 22nd Dec 2005 07:08 PM
VERY Strange behavior! =?Utf-8?B?U2NyYXRjaGluZyBteSBIZWFk?= Windows XP General 7 14th Jan 2005 09:06 AM
changing xp's default stop behavior during a crash from recovery console Jason Gallas Windows XP General 4 16th Oct 2003 08:59 PM
System.Console.In.Peek() behavior? Peter Andersen Microsoft Dot NET Framework 2 1st Oct 2003 12:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:33 PM.