for i=1 to windows.count
if windows(i).name="判断的应用程序名" then
pd=1
exit for
else
pd=0
end if
if pd=1 then msgbox "已激活" else msgbox "未激活"
next
使用API函数激活后,再获取对象。声明(放在模块的声明中):
Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
在函数里调用,如:
ShowWindow FindWindow(vbNullString, "无线宽带"),5
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)