免费视频|新人指南|投诉删帖|广告合作|地信网APP下载

查看: 1649|回复: 1
收起左侧

[技巧] VB 从零开始编外挂(一)

[复制链接]

7656

主题

1175

铜板

2299

好友

技术员

为地信喝彩!

积分
106237
QQ
发表于 2010-6-2 23:09 | 显示全部楼层 |阅读模式
需要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
地质啷http://weibo.com/943569550

133

主题

1066万

铜板

1699

好友

VIP会员

地信网论坛---中国最好的地信地

Rank: 23Rank: 23Rank: 23Rank: 23Rank: 23Rank: 23Rank: 23

积分
31148

官方团队宣传勋章优秀斑主贡献勋章

发表于 2010-6-2 23:20 | 显示全部楼层
    [s:136]
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

在线客服
快速回复 返回顶部 返回列表