首页 > 开发 > 综合 > 正文

VB 从零开始编外挂(一)

2024-07-21 02:20:41
字体:
来源:转载
供稿:网友
需要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


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