VBA解决Windows空当接龙的617局
程序员文章站
2022-03-14 21:22:10
windows的自带游戏空当接龙,其中第617局是比较难解的,需要尝试的次数比较多,而且经常忘记解法和步骤。
原本希望使用autoit或autohotkey、aauto一...
windows的自带游戏空当接龙,其中第617局是比较难解的,需要尝试的次数比较多,而且经常忘记解法和步骤。
原本希望使用autoit或autohotkey、aauto一类的工具,写一段自动化脚本快速解决这一局,但这些工具需要安装,而且容易被当做病毒。通过office中的vba调用windows的api,对游戏窗口发送按键消息,可以快速演示解法。
declare function findwindow lib "user32" alias _ "findwindowa" (byval lpclassname as string, byval lpwindowname as string) as long declare function sendmessage lib "user32" alias _ "sendmessagea" (byval hwnd as long, byval wmsg as long, byval wparam as long, byval lparam as long) as long const wm_char = &h102 sub f() s = "83 80 83 81 80 " & _ "20 27 72 " & _ "48 46 41 48 42 " & _ "89 48 70 74 78 07 40 27 " & _ "10 14 004 10 01 16 19 " & _ "20 002 42 21 20 " & _ "32 34 24 32 42 34 30 38 " & _ "58 53 63 57 56 50 " & _ "10 10 13 15 35 13 12 18" h = findwindow("freewclass", "空当接龙游戏 #617") for i = 1 to len(s) c = mid(s, i, 1) m = 0.1 if c >= "0" and c <= "9" then a = sendmessage(h, wm_char, asc(c), 0) else m = 0.3 end if m = m + timer: do while timer < m: doevents: loop next end sub
上一篇: 软文推广文案该怎么入手?好标题是把尖刀
推荐阅读
-
Windows下Apache + PHP SESSION丢失的解决过程全纪录,apache全纪录
-
win10系统中Windows Defender自动删除下载的文件该怎么解决?
-
windows下php无法使用mcrypt的解决
-
MySQL5.7在Windows8.1下忘记密码的问题解决(图文)
-
详解关于Windows10 Java环境变量配置问题的解决办法
-
解决安装QQ时提示无法访问Windows Installer服务的问题
-
Windows下MySQL 5.7无法启动的解决方法
-
win10系统玩极限竞速6闪屏怎么办?windows10系统玩极限竞速6闪屏的多种解决方法
-
Windows10系统升级10523时提示更新失败解决的方法
-
windows下mysql忘记root密码的解决方法