VB从零开始编外挂(一)
2006-02-27 21:14:08 来源:WEB开发网核心提示:需要VBAPI函数:FindWindow←寻找窗口列表中第一个符合指定条件的顶级窗口GetWindowThreadPRocessId←获取与指定窗口关联在一起的一个进程和线程标识符相关API声明:FindWindow↓PrivateDeclareFunctionFindWindowLib"user32&quo
需要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
->
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
->
更多精彩
赞助商链接