VB从零开始编外挂(一)
下面图老师小编要跟大家分享VB从零开始编外挂(一),简单的过程中其实暗藏玄机,还是要细心学习,喜欢还请记得收藏哦!
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
->