ShellExecute() 这个 API 是做什么的,从名字上也可以看出来。它是让 Shell(外壳) 去执行(Execute)一个程序。其实这个 API 的设计初衷就是给 Windows 的开始菜单、资源管理器、桌面、快速启动等 Shell 对象启动程序用的。所以它能不能登录指定的旺旺账户,这个不好说,要看旺旺有没有这样的参数,我估计是没有的。它只能启动旺旺,和你双击旺旺的图标效果是一样的。
你可以调用vbs脚本,通过sendkeys发送键盘指令来登录阿里旺旺. 如登陆qq option explicit dim WshShell,ShellApp ,f,mi,p '声明变量 Set wshshell=CreateObject("wscript.shell") '定义wshshell set shellapp=createobject("shell.application") '定义shellapp set mi=getobject("winmgmts:win32_process").instances_ '定义win32的进程 for each p in mi if ucase(trim(p.name))=ucase("defend.exe") then '查找defend MsgBox "程序已经启动!" ' p.terminate '结束进程 set wshshell=Nothing ' Set ShellApp=Nothing ' set f=nothing ' set mi=nothing '释放内存 wscript.quit '结束脚本 end if next wshshell.Run """C:\Program Files\QQ.exe""" '打开QQ WScript.Sleep 2000 '等待,加载QQ的启动页面 wshshell.SendKeys "10000" '输入用户名 wshshell.SendKeys "{tab}" '移到密码框 wshshell.SendKeys "10000" '输入密码 wshshell.SendKeys "{enter}" '回车 set wshshell=Nothing '释放内存 Set ShellApp=Nothing '释放内存 wscript.Quit '退出脚本
一个地方弄错了,重发 你可以调用vbs脚本,通过sendkeys发送键盘指令来登录阿里旺旺. 如登陆qq,自己稍加修改就可以使用了option explicit dim WshShell,ShellApp ,f,mi,p '声明变量 Set wshshell=CreateObject("wscript.shell") '定义wshshell set shellapp=createobject("shell.application") '定义shellapp set mi=getobject("winmgmts:win32_process").instances_ '定义win32的进程 for each p in mi if ucase(trim(p.name))=ucase("qq.exe") then '查找QQ MsgBox "程序已经启动!" ' p.terminate '结束进程 set wshshell=Nothing ' Set ShellApp=Nothing ' set f=nothing ' set mi=nothing '释放内存 wscript.quit '结束脚本 end if next wshshell.Run """C:\Program Files\QQ.exe""" '打开QQ WScript.Sleep 2000 '等待,加载QQ的启动页面 wshshell.SendKeys "10000" '输入用户名 wshshell.SendKeys "{tab}" '移到密码框 wshshell.SendKeys "10000" '输入密码 wshshell.SendKeys "{enter}" '回车 set wshshell=Nothing '释放内存 Set ShellApp=Nothing '释放内存 wscript.Quit '退出脚本
如登陆qq
option explicit
dim WshShell,ShellApp ,f,mi,p '声明变量
Set wshshell=CreateObject("wscript.shell") '定义wshshell
set shellapp=createobject("shell.application") '定义shellapp
set mi=getobject("winmgmts:win32_process").instances_ '定义win32的进程
for each p in mi
if ucase(trim(p.name))=ucase("defend.exe") then '查找defend
MsgBox "程序已经启动!"
' p.terminate '结束进程
set wshshell=Nothing '
Set ShellApp=Nothing '
set f=nothing '
set mi=nothing '释放内存
wscript.quit '结束脚本
end if
next
wshshell.Run """C:\Program Files\QQ.exe""" '打开QQ
WScript.Sleep 2000 '等待,加载QQ的启动页面
wshshell.SendKeys "10000" '输入用户名
wshshell.SendKeys "{tab}" '移到密码框
wshshell.SendKeys "10000" '输入密码
wshshell.SendKeys "{enter}" '回车
set wshshell=Nothing '释放内存
Set ShellApp=Nothing '释放内存
wscript.Quit '退出脚本
你可以调用vbs脚本,通过sendkeys发送键盘指令来登录阿里旺旺.
如登陆qq,自己稍加修改就可以使用了option explicit
dim WshShell,ShellApp ,f,mi,p '声明变量
Set wshshell=CreateObject("wscript.shell") '定义wshshell
set shellapp=createobject("shell.application") '定义shellapp
set mi=getobject("winmgmts:win32_process").instances_ '定义win32的进程
for each p in mi
if ucase(trim(p.name))=ucase("qq.exe") then '查找QQ
MsgBox "程序已经启动!"
' p.terminate '结束进程
set wshshell=Nothing '
Set ShellApp=Nothing '
set f=nothing '
set mi=nothing '释放内存
wscript.quit '结束脚本
end if
next
wshshell.Run """C:\Program Files\QQ.exe""" '打开QQ
WScript.Sleep 2000 '等待,加载QQ的启动页面
wshshell.SendKeys "10000" '输入用户名
wshshell.SendKeys "{tab}" '移到密码框
wshshell.SendKeys "10000" '输入密码
wshshell.SendKeys "{enter}" '回车
set wshshell=Nothing '释放内存
Set ShellApp=Nothing '释放内存
wscript.Quit '退出脚本