Solved

VB.net Hide a DOS Window on Process Start

Posted on 2014-10-03
4
319 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
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 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 62

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create a form which is copy of a form in vb.net 2 34
Get String split 5 48
Unable  to create new object 9 41
Help with WinAPI Signatures in VB.NET for SetWindowSubclass 2 35
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now