当前位置:首页 > 程序设计 > VB程序设计 > 游戏辅助 > 详细内容
VB 从零开始编辅助(一)
发布时间:2009/6/29  阅读次数:4510  字体大小: 【】 【】【
需要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
我要评论
  • 匿名发表
  • [添加到收藏夹]
  • 发表评论:(匿名发表无需登录,已登录用户可直接发表。) 登录状态:未登录
最新评论
所有评论[0]
    暂无已审核评论!
Web Lite SWeTE: Simple Website Translation Engine
 


设为首页 | 加入收藏 | 意见建议 | 友情链接 | 版权声明 | 管理登陆 | 编程论坛 | 给我留言

声明:本网站部分稿件来源的所有文字、图片和音视频稿件,来自互联网,若侵犯您的权利,请来信告知,我们将在第一时间内删除!


Copyright 2009-2022 redrose ( wgbcw.com ) All rights reserved ICP备案编号:滇ICP备09007156号 Dict.cn


点击这里给我发消息
点击这里给我发消息