首页 > 学院 > 开发设计 > 正文

VB从零开始编外挂(一)

2019-11-18 17:29:04
字体:
来源:转载
供稿:网友
需要VBAPI函数:
FindWindow←寻找窗口列表中第一个符合指定条件的顶级窗口
GetWindowThreadPRocessId←获取与指定窗口关联在一起的一个进程和线程标识符
--------------------------------------------------------------------------------------------------------------------------------------------------------
相关API声明:
FindWindow

PrivateDeclareFunctionFindWindowLib"user32"Alias"FindWindowA"(ByVallpClassNameAsString,ByVallpWindowNameAsString)AsLong

GetWindowThreadProcessId

PrivateDeclareFunctionGetWindowThreadProcessIdLib"user32"(ByValhwndAsLong,lpdwProcessIdAsLong)
AsLong
--------------------------------------------------------------------------------------------------------------------------------------------------------
需要的控件:Label、Timer
--------------------------------------------------------------------------------------------------------------------------------------------------------自定义函数:
DimhwndAsLong
--------------------------------------------------------------------------------------------------------------------------------------------------------源代码:
PrivateDeclareFunctionFindWindowLib"user32"Alias"FindWindowA"(ByVallpClassNameAsString,ByVallpWindowNameAsString)AsLong
PrivateDeclareFunctionGetWindowThreadProcessIdLib"user32"(ByValhwndAsLong,lpdwProcessIdAsLong)AsLong
PrivateSubTimer1_Timer()
DimhwndAsLong'储存FindWindow函数返回的句柄
hwnd=FindWindow(vbNullString,"WindowsMediaPlayer")'取得进程标识符
'只要把WindowsMediaPlayer换成游戏的名称就可了!
Ifhwnd=0Then
Label1.Caption="游戏未运行"
Else
Label1.Caption="游戏已运行"
EndIf
EndSub
->


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表