使用VB.NET(Compact Framework 2.0)检查进程是否正在运行 [英] Check if process is running with VB.NET (Compact Framework 2.0)

查看:162
本文介绍了使用VB.NET(Compact Framework 2.0)检查进程是否正在运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个(控制台)应用程序,该应用程序应该在启动时执行并且一直在后台运行(每30分钟执行一次)。



我如何在另一个(设备)应用程序中检查我的控制台应用程序是否正在运行(如果不是,则启动它)?



我正在使用VB。 NET CF 2.0和一切都部署在运行WM 6.5(32位)的设备上

我找到的所有代码示例只能在标准.NET上使用。

解决方案

http://social.msdn.microsoft.com/Forums/vstudio/en-US/77153d31-a23f-48d0-a4c4-2a3867370af6/vbnet-check-to-see -if-a-process-is-running [ ^ ]



http://www.dreamincode.net/forums/topic/122521-checking-if-a-process-is-running/ [<一个href =http://www.dreamincode.net/forums/topic/122521-checking-if-a-process-is-running/target =_ blanktitle =New Window> ^ ]



希望这些链接有用。



问候

Sameer

您需要知道进程名称,转到taskmanager并查找所需的进程名称。

用您的进程名称替换sublime_text

  Dim  pName 作为 字符串 =   sublime_text 
Dim psList()作为处理
尝试
psList = Process.GetProcesses()

对于 每个 p 作为处理 psList
如果(pName = p.ProcessName)那么
MsgBox( 找到过程
结束 如果
下一步 p

Catch ex As 异常
Console.WriteLine(ex.Message)
结束 < span class =code-keyword>尝试


I am working on an (console) application, which should be executed on startup and keeps running all the time in the background (executing something every 30 minutes).

How can I, in another (device) application, check if my console application is running (and start it if its not)?

I am using VB.NET CF 2.0 and everything is being deployed on a device running WM 6.5 (32bit)
All the code examples I found where only available on the "standard" .NET.

解决方案

http://social.msdn.microsoft.com/Forums/vstudio/en-US/77153d31-a23f-48d0-a4c4-2a3867370af6/vbnet-check-to-see-if-a-process-is-running[^]

http://www.dreamincode.net/forums/topic/122521-checking-if-a-process-is-running/[^]

Hope these links helpful.

Regards
Sameer


You need to know the process name , go to taskmanager and look for the process name that you want .
replace sublime_text with your process name

Dim pName As String = "sublime_text"
       Dim psList() As Process
       Try
           psList = Process.GetProcesses()

           For Each p As Process In psList
               If (pName = p.ProcessName) Then
                   MsgBox("Process Found")
               End If
           Next p

       Catch ex As Exception
           Console.WriteLine(ex.Message)
       End Try


这篇关于使用VB.NET(Compact Framework 2.0)检查进程是否正在运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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