早教吧作业答案频道 -->其他-->
对VBS代码熟悉的来!帮我注解下.坐等setWshShell=WScript.CreateObject("WScript.Shell")Setdm=CreateObject("dm.dmsoft")WshShell.run("cmd.exe")Whilehwnd=0hwnd=dm.FindWindow("","cmd.exe")wscript.sleep100Wenddmret=dm.GetWindowRect(hw
题目详情
对VBS代码熟悉的来!帮我注解下.坐等
set WshShell = WScript.CreateObject("WScript.Shell")
Set dm= CreateObject("dm.dmsoft")
WshShell.run("cmd.exe")
While hwnd=0
hwnd = dm.FindWindow("","cmd.exe")
wscript.sleep 100
Wend
dm_ret=dm.GetWindowRect(hwnd,x1,y1,x2,y2)
msgbox hwnd & vbcrlf & x1 & "," & y1 & "," & x2 & "," & y2,"打开了DOS窗口"
dm.SetWindowText hwnd,"test"
'hwnd = dm.GetMousePointWindow()
dm_ret = dm.BindWindow(hwnd,"normal","windows","windows",0)
'dm.MoveWindow hwnd,0,0
dm.KeyPress 13
dm.sendstring hwnd,"cls&@echo off"
dm.KeyPress 13
for i=0 to 8
str = "cls&color " & i & (i+1)
dm.sendstring hwnd,str
dm.KeyPress 13
wscript.sleep 200
next
dm.sendstring hwnd,"echo 3秒倒计时&pause"
dm.KeyPress 13
wscript.sleep 3000
dm.KeyPress 13
dm.KeyPress 13
dm.sendstring hwnd,"cls&start notepad&exit"
dm.KeyPress 13
dm_ret = dm.UnBindWindow()
wscript.sleep 500
hwnd1 = dm.FindWindow("","无标题 - 记事本")
if hwnd1>0 then
hwnd = dm.FindWindowEx(hwnd1,"Edit","")
dm_ret = dm.BindWindow(hwnd,"normal","windows","windows",0)
msgbox hwnd1 & vbcrlf & x1 & "," & y1 & "," & x2 & "," & y2 & vbcrlf & "确定后,最小化记事本!","打开了记事本"
dm_ret = dm.SetWindowState(hwnd1,2)
dm.sendstring hwnd,"看到了吧,这个是被最小化过后发送的字符串!" & vbcrlf
wscript.sleep 500
dm_ret = dm.SetWindowState(hwnd1,5)
dim arr
str = "怎 么 样 ,神 奇 ,祝 你 好 运 "
arr = split(str," ")
if hwnd>0 then
for i=0 to ubound(arr)
dm.sendstring hwnd,arr(i)
wscript.sleep 200
next
end if
dm_ret = dm.UnBindWindow()
else
msgobx "未能打开记事本,失败!"
end if
set WshShell = WScript.CreateObject("WScript.Shell")
Set dm= CreateObject("dm.dmsoft")
WshShell.run("cmd.exe")
While hwnd=0
hwnd = dm.FindWindow("","cmd.exe")
wscript.sleep 100
Wend
dm_ret=dm.GetWindowRect(hwnd,x1,y1,x2,y2)
msgbox hwnd & vbcrlf & x1 & "," & y1 & "," & x2 & "," & y2,"打开了DOS窗口"
dm.SetWindowText hwnd,"test"
'hwnd = dm.GetMousePointWindow()
dm_ret = dm.BindWindow(hwnd,"normal","windows","windows",0)
'dm.MoveWindow hwnd,0,0
dm.KeyPress 13
dm.sendstring hwnd,"cls&@echo off"
dm.KeyPress 13
for i=0 to 8
str = "cls&color " & i & (i+1)
dm.sendstring hwnd,str
dm.KeyPress 13
wscript.sleep 200
next
dm.sendstring hwnd,"echo 3秒倒计时&pause"
dm.KeyPress 13
wscript.sleep 3000
dm.KeyPress 13
dm.KeyPress 13
dm.sendstring hwnd,"cls&start notepad&exit"
dm.KeyPress 13
dm_ret = dm.UnBindWindow()
wscript.sleep 500
hwnd1 = dm.FindWindow("","无标题 - 记事本")
if hwnd1>0 then
hwnd = dm.FindWindowEx(hwnd1,"Edit","")
dm_ret = dm.BindWindow(hwnd,"normal","windows","windows",0)
msgbox hwnd1 & vbcrlf & x1 & "," & y1 & "," & x2 & "," & y2 & vbcrlf & "确定后,最小化记事本!","打开了记事本"
dm_ret = dm.SetWindowState(hwnd1,2)
dm.sendstring hwnd,"看到了吧,这个是被最小化过后发送的字符串!" & vbcrlf
wscript.sleep 500
dm_ret = dm.SetWindowState(hwnd1,5)
dim arr
str = "怎 么 样 ,神 奇 ,祝 你 好 运 "
arr = split(str," ")
if hwnd>0 then
for i=0 to ubound(arr)
dm.sendstring hwnd,arr(i)
wscript.sleep 200
next
end if
dm_ret = dm.UnBindWindow()
else
msgobx "未能打开记事本,失败!"
end if
▼优质解答
答案和解析
WshShell.run("cmd.exe") //调用命令行程序
While hwnd=0
hwnd = dm.FindWindow("","cmd.exe")// 循环直到得到命令行程序的窗口句柄
wscript.sleep 100
Wend
dm_ret=dm.GetWindowRect(hwnd,x1,y1,x2,y2)//得到窗口大小位置参数
msgbox hwnd & vbcrlf & x1 & "," & y1 & "," & x2 & "," & y2,"打开了DOS窗口"//显示对话框
dm.SetWindowText hwnd,"test"//更改窗口标题
dm.sendstring hwnd,"cls&@echo off" 向窗口发送字符串信息
下面都差不多了,原理一样
While hwnd=0
hwnd = dm.FindWindow("","cmd.exe")// 循环直到得到命令行程序的窗口句柄
wscript.sleep 100
Wend
dm_ret=dm.GetWindowRect(hwnd,x1,y1,x2,y2)//得到窗口大小位置参数
msgbox hwnd & vbcrlf & x1 & "," & y1 & "," & x2 & "," & y2,"打开了DOS窗口"//显示对话框
dm.SetWindowText hwnd,"test"//更改窗口标题
dm.sendstring hwnd,"cls&@echo off" 向窗口发送字符串信息
下面都差不多了,原理一样
看了 对VBS代码熟悉的来!帮我注...的网友还看了以下:
密度的单位换算1g/l³1kg/dm³1g/cm³求这些密度单位的换算进率,不要计算过程,只要结果 2020-05-15 …
求解释一个整人关机软件的意思.是用什么语言写的.onerrorresumenextdimWSHsh 2020-06-15 …
一、0.345L=()mL=()cm³1300cm³=()mL=()L8dm³=()L=()mL3 2020-07-18 …
如图,K是正方形ABCD内一点,以AK为一边作正方形AKLM,使L,M,D在AK的同旁,连接BK和 2020-07-21 …
VBS里“createobject("wscript.shell").run“后面的",0,cre 2020-07-23 …
英语翻译onerrorresumenextdimWSHshellAsetWSHshellA=wsc 2020-07-23 …
对VBS代码熟悉的来!帮我注解下.坐等setWshShell=WScript.CreateObje 2020-07-23 …
谁能帮我看下这是什么意思.onerrorresumenextdimWSHshellAsetWSHs 2020-07-23 …
如图,K是正方形ABCD内一点,以AK为一边作正方形AKLM,使L,M,D在AK的同旁,连接BK和D 2020-10-31 …
如图,K是正方形ABCD内一点,以AK为一边作正方形AKLM,使L,M,D在AK的同旁,连接BK和D 2020-10-31 …