创建Windows服务,启动的程序进程为什么会隐藏
本人创建一个Windows服务,都可以正常使用,正从服务中启动的另外一个程序的进程会自动隐藏(即在任务管理器中不可见),在360的进程管理器中会看到,想请教各位,这是什么原因造成的,如何调整,谢谢!
程序的代码如下:
Imports System.IO
Imports System.Threading
Public Class MtzService
'定义系统运行目录
Private sAppPath As String = PathAddSlash(AppDomain.CurrentDomain.BaseDirectory.ToString())
Protected Overrides Sub OnStart(ByVal args() As String)
' 请在此处添加代码以启动您的服务。此方法应完成设置工作,
' 以使您的服务开始工作。
If File.Exists(sAppPath & "MTZSERVER.exe") <> False Then
Dim proInfo As New ProcessStartInfo
proInfo.FileName = sAppPath & "MTZSERVER.exe"
proInfo.WindowStyle = ProcessWindowStyle.Normal
System.Diagnostics.Process.Start(proInfo)
Thread.Sleep(18000)
End If
End Sub
Protected Overrides Sub OnStop()
' 在此处添加代码以执行任何必要的拆解操作,从而停止您的服务。
End Sub
'****************************************************************
' 路径增加分隔符
'****************************************************************
Private Function PathAddSlash(ByVal sPath As String) As String
If sPath.Substring(sPath.Length - 1) = "\" Then
PathAddSlash = sPath
Else
PathAddSlash = sPath & "\"
End If
End Function
End Class