?
Solved

VB.net Hide a DOS Window on Process Start

Posted on 2014-10-03
4
Medium Priority
?
370 Views
Last Modified: 2014-10-06
Hello Experts!
OK, I CAN NOT figure this out...so HELP!

Why does my DOS Window Show?  I don't want the Process DOS Window to Show!

                    myProcess = New Process
                    With myProcess
                        .StartInfo.RedirectStandardError = True
                        .StartInfo.RedirectStandardOutput = True
                        .StartInfo.UseShellExecute = False
                        .StartInfo.CreateNoWindow = True
                        .StartInfo.FileName = ConfigurationManager.AppSettings("ExportProgram")
                        .StartInfo.Arguments = " action=OutUpdate xml=" & sFile.FullName & " outputFile=" & sLogFile
                        .StartInfo.WorkingDirectory = ConfigurationManager.AppSettings("WorkingDirectory")
                    End With

                    myProcess.Start()
                    Application.DoEvents()
0
Comment
Question by:smithmrk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 2000 total points
ID: 40360204
Try using the show window function to hide it:

<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function FindWindow( _
     ByVal lpClassName As String, _
     ByVal lpWindowName As String) As IntPtr
End Function

<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function ShowWindow(ByVal hwnd As IntPtr, ByVal nCmdShow As ShowWindowCommands) As Boolean
End Function



Dim hWnd as IntPtr  = FindWindow(null, "name of the window")
if (hWnd <> IntPtr.Zero) then 
     ShowWindow(hWnd, 0)  'SW_HIDE
end if

Open in new window

0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 40360216
The CreateNoWindow  has the meaning, "Gets or sets a value indicating whether to start the process in a new window.", not what you are looking for.

Replace this line in the code.

.StartInfo.CreateNoWindow = True

With this line of code.

.StartInfo.WindowStyle = ProcessWindowStyle.Hidden

See if this give you what you are looking for.
0
 

Author Comment

by:smithmrk
ID: 40363497
This has a blue line under it?
It doesn't like this:

<DllImport

Mark
0
 

Author Closing Comment

by:smithmrk
ID: 40363890
I figured out my problem!

Thanks,
Mark
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question