应用已经运行? [英] App already running?
问题描述
嘿所有,
另一个转换为vb.net。我的vb6程序是一个应用程序
启动程序,用于检查所述程序的先前实例,并且将使用消息框警告用户
。对于我的生活,我不能想象如何在vb.net中执行此操作。让我们说notepad.exe(作为一个例子)已经运行了
。我的程序试图再次启动它,但我需要
检查notepad.exe是否已经在我启动之前运行。
有没有人剪断编码来帮助我吗?我已经用Google搜索了我的屁股,而我最接近的就是检查/ my / app之前的
实例,我甚至都不能得到/那/上班。
听起来很简单,但我很难过。
感谢您的帮助!
-b
Hey all,
Another convert to vb.net here. My vb6 program was an application
launcher that checked for previous instances of said programs and would
alert the user with a message box. I can''t, for the life of me, figure
out how to do this in vb.net. Let''s say notepad.exe (as an example) is
already running. My program tries to launch it again, but I need to
check if notepad.exe is already running before I launch it.
Does anyone have a snipped to code to help me out here? I''ve googled
my arse off and the closest I can get is to check for a previous
instance of /my/ app, and I can''t even get /that/ to work.
Sounds simple, but I''m stumped.
Thanks for any help!
-b
推荐答案
我确定有一个可以满足您需求的Windows API。我或许能够找到它,但现在没有时间。同时,祝你好运
-
谢谢。
ro ** ***@hotmail.com
" Bradley"写道:
I''m sure there''s a windows API that will do just what you want. I may be able
to find it, but don''t have time right now. Meanwhile, good luck
--
Thanks.
ro*****@hotmail.com
"Bradley" wrote:
嘿所有,
另一个转换为vb.net在这里。我的vb6程序是一个应用程序
启动程序,用于检查所述程序的先前实例,并将通过消息框提醒用户。对于我的生活,我不能在vb.net中知道如何做到这一点。让我们说notepad.exe(作为一个例子)已经运行了。我的程序试图再次启动它,但是我需要在启动它之前检查notepad.exe是否已经运行。
有没有人有剪切代码来帮助我在这里?我已经用Google搜索了我的屁股,而我最接近的就是检查以前的/ my / app实例,我甚至无法获得/那个/工作。
听起来很简单,但我很难过。
感谢您的帮助!
-b
Hey all,
Another convert to vb.net here. My vb6 program was an application
launcher that checked for previous instances of said programs and would
alert the user with a message box. I can''t, for the life of me, figure
out how to do this in vb.net. Let''s say notepad.exe (as an example) is
already running. My program tries to launch it again, but I need to
check if notepad.exe is already running before I launch it.
Does anyone have a snipped to code to help me out here? I''ve googled
my arse off and the closest I can get is to check for a previous
instance of /my/ app, and I can''t even get /that/ to work.
Sounds simple, but I''m stumped.
Thanks for any help!
-b
这里是我为VB6创建的一些代码 -
公共声明函数GetWindow Lib" user32" (_
ByVal hwnd As Long,_
ByVal wCmd As Long _
)As Long
Public Declare Function GetWindowText Lib" user32" _
Alias" GetWindowTextA" (_
ByVal hwnd As Long,_
ByVal lpString As String,_
ByVal cch As Long _
)As Long
公共声明函数GetWindowTextLength Lib" user32" _
Alias" GetWindowTextLengthA" (_
ByVal hwnd As Long _
)As Long
Public Const GW_HWNDFIRST = 0
公共Const GW_HWNDLAST = 1
Public Const GW_HWNDNEXT = 2
Public Const GW_HWNDPREV = 3
Public Const GW_OWNER = 4
Public Const GW_CHILD = 5
Sub LoadTaskList(FHandle As Long,Wins
Here''s some code I created for VB6 --
Public Declare Function GetWindow Lib "user32" ( _
ByVal hwnd As Long, _
ByVal wCmd As Long _
) As Long
Public Declare Function GetWindowText Lib "user32" _
Alias "GetWindowTextA" ( _
ByVal hwnd As Long, _
ByVal lpString As String, _
ByVal cch As Long _
) As Long
Public Declare Function GetWindowTextLength Lib "user32" _
Alias "GetWindowTextLengthA" ( _
ByVal hwnd As Long _
) As Long
Public Const GW_HWNDFIRST = 0
Public Const GW_HWNDLAST = 1
Public Const GW_HWNDNEXT = 2
Public Const GW_HWNDPREV = 3
Public Const GW_OWNER = 4
Public Const GW_CHILD = 5
Sub LoadTaskList(FHandle As Long, Wins
())
''加载字幕和Wins中所有窗口的句柄
())
''loads captions and handles of all windows in Wins
这篇关于应用已经运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!