VB中 如何判断程序是否在运行??

VB中如何判断程序是否在运行??点击COMMAND1运行程序!在点击时判断程序是否在运行如果是的话弹出提示框!麻烦写下代码!... VB中如何判断程序是否在运行??
点击 COMMAND1
运行程序!
在点击时
判断 程序是否在运行
如果是的话 弹出提示框!
麻烦写下代码!
展开
 我来答
PAL神仙
2008-05-02 · TA获得超过461个赞
知道小有建树答主
回答量:229
采纳率:0%
帮助的人:223万
展开全部
Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32.dll" (ByVal hProcess As Long, ByRef lpExitCode As Long) As Long
Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Private Const PROCESS_QUERY_INFORMATION As Long = (&H400)
Private Const STILL_ACTIVE As Long = &H103
Public hShell As Long, hProc As Long, lExit As Long
Private Sub Command1_Click()
hProc = OpenProcess(PROCESS_QUERY_INFORMATION, False, hShell)
GetExitCodeProcess hProc, lExit
If lExit = STILL_ACTIVE Then
MsgBox "程序正在运行"
Else
hShell = Shell("cmd.exe")
End If
End Sub
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式