473,659 Members | 3,631 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
"WaitforExi t" but not hide the DOS box. If I create a
"System.Diagnos tics.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 1953
* "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
"WaitforExi t" but not hide the DOS box. If I create a
"System.Diagnos tics.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.Diagnost ics.ProcessStar tInfo()
p.Verb = "print"
p.CreateNoWindo w = True
p.WindowStyle = ProcessWindowSt yle.Hidden
p.FileName = "C:\filename.ex e"
System.Diagnost ics.Process.Sta rt(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******** ******@TK2MSFTN GP10.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 "WaitforExi t" but not hide the DOS box. If I create a
"System.Diagnos tics.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.Diagnost ics.ProcessStar tInfo()
p.Verb = "print"
p.CreateNoWindo w = True
p.WindowStyle = ProcessWindowSt yle.Hidden
p.FileName = "C:\filename.ex e"
System.Diagnost ics.Process.Sta rt(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.Diagnost ics.ProcessStar tInfo()
p.Verb = "print"
p.CreateNoWindo w = True
p.WindowStyle = ProcessWindowSt yle.Hidden
p.FileName = "C:\filename.ex e"
Dim pr As System.Diagnost ics.Process = System.Diagnost ics.Process.Sta rt(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.Diagnost ics.ProcessStar tInfo

p.Verb = "print"

p.CreateNoWindo w = True

p.WindowStyle = ProcessWindowSt yle.Hidden

p.UseShellExecu te = False

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

p.FileName = "C:\mame\mame.e xe"

Dim pr As System.Diagnost ics.Process = System.Diagnost ics.Process.Sta rt(p)

System.Diagnost ics.Process.Sta rt(p)

pr.WaitForExit( )

response = MsgBox("Your file has been created successfully.",
MsgBoxStyle.Inf ormation, "CPViewer")
I am trying to keep it simple to get it working. The actual commandline is
"C:\Mame\Mame.e xe -listinfo> C:\Program Files\CPViewer\ MameGames.cfg". In my
code I want to use Application.Sta rtupPath 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.Sta rtupPath & "\CreateMameGam esCFG.bat"
Dim sr As StreamWriter = File.CreateText (strInput)

sr.WriteLine(lb lMameExePath.Te xt & " -listinfo >""" &
Application.Sta rtupPath & "\mamegames.cfg """)

sr.Close()

Dim p As New System.Diagnost ics.ProcessStar tInfo

p.WindowStyle = ProcessWindowSt yle.Hidden

p.FileName = strInput

p.UseShellExecu te = True

System.Diagnost ics.Process.Sta rt(p)

response = MsgBox("Your file has been created successfully.",
MsgBoxStyle.Inf ormation, "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(App lication.Startu pPath & "\CreateMameGam esCFG.bat") Then

Dim path3 As String = Application.Sta rtupPath & "\CreateMameGam esCFG.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******** ********@TK2MSF TNGP10.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.Diagnost ics.ProcessStar tInfo()
p.Verb = "print"
p.CreateNoWindo w = True
p.WindowStyle = ProcessWindowSt yle.Hidden
p.FileName = "C:\filename.ex e"
Dim pr As System.Diagnost ics.Process = System.Diagnost ics.Process.Sta rt(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.e xe -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.WaitCur sor

Dim psi As New System.Diagnost ics.ProcessStar tInfo(lblMameEx ePath.Text,
" -listinfo")

psi.UseShellExe cute = False
psi.ErrorDialog = False
psi.RedirectSta ndardOutput = True
psi.RedirectSta ndardError = False
psi.CreateNoWin dow = True

Dim myProcess As New Process
myProcess = Process.Start(p si)

Dim output As String = myProcess.Stand ardOutput.ReadT oEnd()

myProcess.WaitF orExit()

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

If File.Exists(pat h) Then
File.Delete(pat h)
End If

Dim sw As StreamWriter = New StreamWriter(pa th)
sw.WriteLine(ou tput)
sw.Close()

Me.Cursor = Cursors.Default

"jcrouse" <me> wrote in message
news:ON******** ******@TK2MSFTN GP10.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.Diagnost ics.ProcessStar tInfo

p.Verb = "print"

p.CreateNoWindo w = True

p.WindowStyle = ProcessWindowSt yle.Hidden

p.UseShellExecu te = False

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

p.FileName = "C:\mame\mame.e xe"

Dim pr As System.Diagnost ics.Process = System.Diagnost ics.Process.Sta rt(p)

System.Diagnost ics.Process.Sta rt(p)

pr.WaitForExit( )

response = MsgBox("Your file has been created successfully.",
MsgBoxStyle.Inf ormation, "CPViewer")
I am trying to keep it simple to get it working. The actual commandline is
"C:\Mame\Mame.e xe -listinfo> C:\Program Files\CPViewer\ MameGames.cfg". In
my
code I want to use Application.Sta rtupPath 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.Sta rtupPath &
"\CreateMameGam esCFG.bat"
Dim sr As StreamWriter = File.CreateText (strInput)

sr.WriteLine(lb lMameExePath.Te xt & " -listinfo >""" &
Application.Sta rtupPath & "\mamegames.cfg """)

sr.Close()

Dim p As New System.Diagnost ics.ProcessStar tInfo

p.WindowStyle = ProcessWindowSt yle.Hidden

p.FileName = strInput

p.UseShellExecu te = True

System.Diagnost ics.Process.Sta rt(p)

response = MsgBox("Your file has been created successfully.",
MsgBoxStyle.Inf ormation, "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(App lication.Startu pPath & "\CreateMameGam esCFG.bat") Then

Dim path3 As String = Application.Sta rtupPath &
"\CreateMameGam esCFG.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******** ********@TK2MSF TNGP10.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.Diagnost ics.ProcessStar tInfo()
p.Verb = "print"
p.CreateNoWindo w = True
p.WindowStyle = ProcessWindowSt yle.Hidden
p.FileName = "C:\filename.ex e"
Dim pr As System.Diagnost ics.Process =
System.Diagnost ics.Process.Sta rt(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
1664
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 containing text, which I amend as appropriate with innerhtml One is an image. One is a div containing 4 input text boxes, which are disabled or not as appropriate. I've tried .style.visibility = "hidden" / "visible" (correctly leaves
1
2583
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 where when someone clicks on a dropdown and selects an item, it will hide 2 other dropdown boxes that are related as the input in those are applicable. When I save those items, everything gets into the db fine.
2
2893
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 visible, is just the drop down arrow button on the combo boxes. Is there a way of hiding this button until the field has focus? Thank you for your help Tim G
0
1196
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 little too effective and hides all of them including hiding the database window. What I am after is the same effect as disabling all the check boxes in startup which still leaves 'File', 'Edit', 'Insert','Records','Window' &'Help'. I want to do...
5
3887
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 seperate message boxes making sure that is what they want to do. The first one says: "are you sure you want to run that query", and the second says "You are about to update 1 row". Is there a way to code this so those message boxes are either...
2
7628
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 mentioning the class members(functions, typedefs, data) under the access control labels : public, protected, private. Encapsulation means providing the implementation of class member
2
1182
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 for a while but he has figured out how to ctrl alt del and end the process. He also knows how to get in doss. I am trying to figure out a way to stop him. I was thinking of setting up a service and monitoring the app, but that's not fool proof. I...
162
10222
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 prefix them with 2 underscores, but I hate prefixing my vars, I'd rather add a keyword before it. Python advertises himself as a full OOP language, but why does it miss one of the basic principles of OOP? Will it ever be added to python?
4
3990
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 as desired. Does anyone know if there is a known issue with hiding a process window when you run it as a different user? Do you have any suggestions to work around this problem? Thank you. Process proc = new Process();...
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8337
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8628
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7359
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.