您的位置:逆风者 VB 正文
原作者:www.upwinder.com 添加时间:2007-09-02 原文发表:2007-08-31 人气:18 来源:未知

需要VB API函数
逆风者
FindWindow ←寻找窗口列表中第一个符合指定条件的顶级窗口
GetWindowThreadProcessId ←获取与指定窗口关联在一起的一个进程和线程标识符
--------------------------------------------------------------------------------------------------------------------------------------------------------
相关API声明:
FindWindow

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

GetWindowThreadProcessId

Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long)
As Long
--------------------------------------------------------------------------------------------------------------------------------------------------------
需要的控件:Label、Timer
-------------------------------------------------------------------------------------------------------------------------------------------------------- 自定义函数
Dim hwnd As Long
-------------------------------------------------------------------------------------------------------------------------------------------------------- 源代码:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long)As Long
Private Sub Timer1_Timer()
Dim hwnd As Long' 储存 FindWindow 函数返回的句柄
hwnd = FindWindow(VBNullString, "Windows Media Player")' 取得进程标识符
'只要把Windows Media Player换成游戏的名称就可了!
If hwnd = 0 Then
Label1.Caption = "游戏未运行"
Else
Label1.Caption = "游戏已运行"
End If
End Sub

相关文章

Love Letter病毒源代码
VB中远程共享显示及声音的实现
制作带有动画和声音的屏幕保护程序
用Visual Basic与MS-Draw开发通用作图软件
解除网虫心病 VB做定时断线程序
带有历史记录功能的菜单
如何用VB建立快捷方式
VB应用程序中打印条形码的两种方法
利用VB实现浮动按钮
在WindowsNT网络中广播消息
用VB编写异步多线程下载程序
VB6中使用错误处理对程序速度的影响
用VB编写一个光驱保镖
用VB实现浮动按钮
在程序中打开 Internet 拨号连接窗口
用VB打造自己的SQL连接器
VB 从零开始编外挂(七)
VB创建位图菜单
无框窗体移动最简法(程序)
用Winsock制作一套聊天室和对话系统

相关评论


本文章所属分类:首页 VB

  热门关键字: