如何隐藏DOS窗口? [英] How to hide the DOS window?

查看:436
本文介绍了如何隐藏DOS窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对vb.net比较陌生.....我知道在任何版本中我都是新的

VB。所以我

道歉,如果这太愚蠢了。

我试图启动并停止一个特定文件

使用process.start()

和process.kill()。

这些都在工作,但DOS窗口总是出现



隐藏DOS窗口我错过了什么?

我试过.hidden,.minimized,删除了

窗口样式completeley。我没有找到隐藏DOS窗口的方法。

任何帮助都表示赞赏。





I am relativly new to vb.net ..... heck I'm new to
VB in any version. So I
apologize if this is overly dumb.
I am trying to start and stop a particular file
using the process.start()
and process.kill().
These are working but the DOS window is always
appearing.
What am I missing to hide the DOS window?
I have tried .hidden, .minimized, removed the
window style completeley. I
haven't found a way to hide the DOS window.
Any help is appreciated.


Dim mProcess As Process 'form level
Private Sub Form1_Load(ByVal sender As Object,
    ByVal e As System.EventArgs)
    Handles MyBase.Load
    mProcess = New Process
    With mProcess.StartInfo
        ..FileName = "repstore.exe"
        ..Arguments = "3104"
        ..UseShellExecute = False
        ..WindowStyle = ProcessWindowStyle.Hidden
        ..RedirectStandardOutput = True
        ..RedirectStandardInput = True
        End With
    End Sub
Private Sub btnStart_Click(ByVal sender As
    System.Object, ByVal e As
    System.EventArgs) Handles btnStart.Click
    mProcess.Start()
    End Sub
Private Sub btnStop_Click(ByVal sender As
    Object, ByVal e As
    System.EventArgs) Handles btnStop.Click
    mProcess.Kill()
    End Sub





我相对来说是vb.net的新手.....我知道我是在任何版本中都是新的

VB。所以我

道歉,如果这太愚蠢了。

我试图启动并停止一个特定文件

使用process.start()

和process.kill()。

这些都在工作,但DOS窗口总是出现



隐藏DOS窗口我错过了什么?

我试过.hidden,.minimized,删除了

窗口样式completeley。我没有找到隐藏DOS窗口的方法。

任何帮助都表示赞赏。







I am relativly new to vb.net ..... heck I'm new to
VB in any version. So I
apologize if this is overly dumb.
I am trying to start and stop a particular file
using the process.start()
and process.kill().
These are working but the DOS window is always
appearing.
What am I missing to hide the DOS window?
I have tried .hidden, .minimized, removed the
window style completeley. I
haven't found a way to hide the DOS window.
Any help is appreciated.


Dim mProcess As Process 'form level
Private Sub Form1_Load(ByVal sender As Object,
    ByVal e As System.EventArgs)
    Handles MyBase.Load
    mProcess = New Process
    With mProcess.StartInfo
        ..FileName = "repstore.exe"
        ..Arguments = "3104"
        ..UseShellExecute = False
        ..WindowStyle = ProcessWindowStyle.Hidden
        ..RedirectStandardOutput = True
        ..RedirectStandardInput = True
        End With
End Sub
Private Sub btnStart_Click(ByVal sender As
    System.Object, ByVal e As
    System.EventArgs) Handles btnStart.Click
    mProcess.Start()
End Sub
Private Sub btnStop_Click(ByVal sender As
Object, ByVal e As
    System.EventArgs) Handles btnStop.Click
    mProcess.Kill()
End Sub





[edit]已添加代码块 - OriginalGriff [/ edit]



[edit]Code block added - OriginalGriff[/edit]

推荐答案

您需要将 Process.StartInfo.CreateNoWindow 属性设置为 True as好吧。

应该修复它。



错误的代码样式:doh: - OriginalGriff [/ edit]
You need to set the Process.StartInfo.CreateNoWindow property to True as well.
That should fix it.

[edit]Wrong code style :doh: - OriginalGriff[/edit]


这篇关于如何隐藏DOS窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆