473,504 Members | 13,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hiding process DOS boxes, How?

This is kind of a continuation of another thread that was somewhat resolved:

Well, the dilemma seems to be this. I want to be able to hide the DOS box
AND pause the code until execution is complete. If I create a process, I can
"WaitforExit" but not hide the DOS box. If I create a
"System.Diagnostics.Process", I can hide the DOS box but can't pause until
the execution is complete. How can I have the best of both worls?

Thank you,
John
Nov 20 '05 #1
6 1946
* "jcrouse" <me> scripsit:
Well, the dilemma seems to be this. I want to be able to hide the DOS box
AND pause the code until execution is complete. If I create a process, I can
"WaitforExit" but not hide the DOS box. If I create a
"System.Diagnostics.Process", I can hide the DOS box but can't pause until
the execution is complete. How can I have the best of both worls?


\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.CreateNoWindow = True
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.exe"
System.Diagnostics.Process.Start(p)
p.WaitForExit()
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
There is no "p.WaitForExit()" or am I missing something here?

Thanks,
John

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OQ**************@TK2MSFTNGP10.phx.gbl...
* "jcrouse" <me> scripsit:
Well, the dilemma seems to be this. I want to be able to hide the DOS box AND pause the code until execution is complete. If I create a process, I can "WaitforExit" but not hide the DOS box. If I create a
"System.Diagnostics.Process", I can hide the DOS box but can't pause until the execution is complete. How can I have the best of both worls?


\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.CreateNoWindow = True
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.exe"
System.Diagnostics.Process.Start(p)
p.WaitForExit()
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #3
* "jcrouse" <me> scripsit:
There is no "p.WaitForExit()" or am I missing something here?


My bad. I made a mistake:

\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.CreateNoWindow = True
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.exe"
Dim pr As System.Diagnostics.Process = System.Diagnostics.Process.Start(p)
pr.WaitForExit()
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4
Well Herfried, I'm stuck. Here is my code:

Dim strInput1 As String = (lblMameExePath.Text & " -listinfo >C:\test.cfg")

Dim p As New System.Diagnostics.ProcessStartInfo

p.Verb = "print"

p.CreateNoWindow = True

p.WindowStyle = ProcessWindowStyle.Hidden

p.UseShellExecute = False

p.Arguments = " -listinfo> C:\test.cfg"

p.FileName = "C:\mame\mame.exe"

Dim pr As System.Diagnostics.Process = System.Diagnostics.Process.Start(p)

System.Diagnostics.Process.Start(p)

pr.WaitForExit()

response = MsgBox("Your file has been created successfully.",
MsgBoxStyle.Information, "CPViewer")
I am trying to keep it simple to get it working. The actual commandline is
"C:\Mame\Mame.exe -listinfo> C:\Program Files\CPViewer\MameGames.cfg". In my
code I want to use Application.StartupPath in place of "C:\Program
Files\CPViewer" but I'll get to that later. I have another post somewhere
and have read others about spaces in paths and the command window not
agreeing. The above code executes without errors but not file is created. I
am using the following code sucessfully but can't pause it.

Dim strInput As String = Application.StartupPath & "\CreateMameGamesCFG.bat"
Dim sr As StreamWriter = File.CreateText(strInput)

sr.WriteLine(lblMameExePath.Text & " -listinfo >""" &
Application.StartupPath & "\mamegames.cfg""")

sr.Close()

Dim p As New System.Diagnostics.ProcessStartInfo

p.WindowStyle = ProcessWindowStyle.Hidden

p.FileName = strInput

p.UseShellExecute = True

System.Diagnostics.Process.Start(p)

response = MsgBox("Your file has been created successfully.",
MsgBoxStyle.Information, "CPViewer")

As you can see, I create a batch file containing my command then execute the
batch file. I then remove the batch file upon exiting the form with this
code:

If File.Exists(Application.StartupPath & "\CreateMameGamesCFG.bat") Then

Dim path3 As String = Application.StartupPath & "\CreateMameGamesCFG.bat"

Dim fi3 As FileInfo = New FileInfo(path3)

fi3.Delete()

End If
BUT, I can't get the code to pause until the cfg file is created. What am I
missing here?

Thank you for your help,
John



"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
* "jcrouse" <me> scripsit:
There is no "p.WaitForExit()" or am I missing something here?


My bad. I made a mistake:

\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.CreateNoWindow = True
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.exe"
Dim pr As System.Diagnostics.Process = System.Diagnostics.Process.Start(p)
pr.WaitForExit()
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #5
* "jcrouse" <me> scripsit:
I am trying to keep it simple to get it working. The actual commandline is
"C:\Mame\Mame.exe -listinfo> C:\Program Files\CPViewer\MameGames.cfg". In my


'>' is a feature of the command shell. You will have to start "cmd.exe"
and then launch your app from the command line. A sample for grabbing
the command line's output can be found here:

<URL:http://dotnet.mvps.org/dotnet/samples/miscsamples/downloads/RedirectConsole.zip>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #6
John, why not use the code we came up with from before? Just add Herfried's
"CreateNoWindow". Once you have the string variable (output) filled, it is
pretty straight forward to just write that to a new text file named
"MameGames.cfg".

Greg

Me.Cursor = Cursors.WaitCursor

Dim psi As New System.Diagnostics.ProcessStartInfo(lblMameExePath .Text,
" -listinfo")

psi.UseShellExecute = False
psi.ErrorDialog = False
psi.RedirectStandardOutput = True
psi.RedirectStandardError = False
psi.CreateNoWindow = True

Dim myProcess As New Process
myProcess = Process.Start(psi)

Dim output As String = myProcess.StandardOutput.ReadToEnd()

myProcess.WaitForExit()

Dim path As String = "C:\Program Files\CPViewer\MameGames.cfg"

If File.Exists(path) Then
File.Delete(path)
End If

Dim sw As StreamWriter = New StreamWriter(path)
sw.WriteLine(output)
sw.Close()

Me.Cursor = Cursors.Default

"jcrouse" <me> wrote in message
news:ON**************@TK2MSFTNGP10.phx.gbl...
Well Herfried, I'm stuck. Here is my code:

Dim strInput1 As String = (lblMameExePath.Text & " -listinfo
>C:\test.cfg")


Dim p As New System.Diagnostics.ProcessStartInfo

p.Verb = "print"

p.CreateNoWindow = True

p.WindowStyle = ProcessWindowStyle.Hidden

p.UseShellExecute = False

p.Arguments = " -listinfo> C:\test.cfg"

p.FileName = "C:\mame\mame.exe"

Dim pr As System.Diagnostics.Process = System.Diagnostics.Process.Start(p)

System.Diagnostics.Process.Start(p)

pr.WaitForExit()

response = MsgBox("Your file has been created successfully.",
MsgBoxStyle.Information, "CPViewer")
I am trying to keep it simple to get it working. The actual commandline is
"C:\Mame\Mame.exe -listinfo> C:\Program Files\CPViewer\MameGames.cfg". In
my
code I want to use Application.StartupPath in place of "C:\Program
Files\CPViewer" but I'll get to that later. I have another post somewhere
and have read others about spaces in paths and the command window not
agreeing. The above code executes without errors but not file is created.
I
am using the following code sucessfully but can't pause it.

Dim strInput As String = Application.StartupPath &
"\CreateMameGamesCFG.bat"
Dim sr As StreamWriter = File.CreateText(strInput)

sr.WriteLine(lblMameExePath.Text & " -listinfo >""" &
Application.StartupPath & "\mamegames.cfg""")

sr.Close()

Dim p As New System.Diagnostics.ProcessStartInfo

p.WindowStyle = ProcessWindowStyle.Hidden

p.FileName = strInput

p.UseShellExecute = True

System.Diagnostics.Process.Start(p)

response = MsgBox("Your file has been created successfully.",
MsgBoxStyle.Information, "CPViewer")

As you can see, I create a batch file containing my command then execute
the
batch file. I then remove the batch file upon exiting the form with this
code:

If File.Exists(Application.StartupPath & "\CreateMameGamesCFG.bat") Then

Dim path3 As String = Application.StartupPath &
"\CreateMameGamesCFG.bat"

Dim fi3 As FileInfo = New FileInfo(path3)

fi3.Delete()

End If
BUT, I can't get the code to pause until the cfg file is created. What am
I
missing here?

Thank you for your help,
John



"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
* "jcrouse" <me> scripsit:
> There is no "p.WaitForExit()" or am I missing something here?


My bad. I made a mistake:

\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.CreateNoWindow = True
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.exe"
Dim pr As System.Diagnostics.Process =
System.Diagnostics.Process.Start(p)
pr.WaitForExit()
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>


Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1656
by: Chris Sharman | last post by:
I've got 3 'alternative' boxes, only one of which I want displayed, according to the value of an earlier select (so I'm using the <htmlelement>.style property from javascript). One is a div...
1
2581
by: MN | last post by:
Greetings to all - I'm having some fits with getting this to work but I'm near the end and I'm hoping this one obstacle is not a huge one to get past. Here's my scenario: I have a page...
2
2872
by: Tim Graichen | last post by:
I currently have a form with several combo boxes. I have the background properties and boarder properties of all form fields set as transparent. Therefore, the only part of the controls that are...
0
1179
by: Mark Reed | last post by:
Hi all, Access 2002 XP platform. I am trying to learn a little about programming (I know next to nothing so far) and have found some code which hides the toolbars. However, this bit of code is a...
5
3883
by: HowardChr | last post by:
I have my program set up so that when a button called "Clear" is clicked, it clears all Yes/No fields from a seperate table. The problem is that when that button is clicked, it is coming up with 2...
2
7612
by: subramanian100in | last post by:
Is my following understanding correct ? Data abstraction means providing the interface - that is, the set of functions that can be called by the user of a class. Information hiding means...
2
1171
by: styles | last post by:
Hey, I'm creating a app in C# to monitor my kids computer usage. I right now have a timer running. It at the correct time brings up MessageBox.Show's and tells him to get off. Now, this has worked...
162
10065
by: Sh4wn | last post by:
Hi, first, python is one of my fav languages, and i'll definitely keep developing with it. But, there's 1 one thing what I -really- miss: data hiding. I know member vars are private when you...
4
3978
by: =?Utf-8?B?SHVleQ==?= | last post by:
I need to hide the new window started from the code below. If I run as is, the window is visible. If I comment out the code that sets a different user, domain, and password the window is hidden...
0
7213
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.