早教吧作业答案频道 -->其他-->
对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代码熟悉的来!帮我注...的网友还看了以下:
GM/(R+H)^2=V^2/(R+H)化简得V=根号GM/(R+H)化简是怎么算下来的呢 2020-06-02 …
请问错在哪里,应如何改正>>v=0.7:1.2;>>h=0.1:0.5;>>[h,v]=meshg 2020-06-11 …
ABCD是有同种材料制成的四个圆柱体高度相同G不同,比较p=F/S=G/S=mg/(V/h)=mg 2020-06-26 …
ABCD是有同种材料制成的四个圆柱体,高度相同G不同p=F/S=G/S=mg/(V/h)=mgh/ 2020-06-26 …
一辆汽车以速度v行驶了2/3的路程,接着以20km/h的速度跑完了余下的路程,若全程的平均速度是2 2020-07-01 …
1.一辆汽车以速率v行驶了2/3的路程,接着以20km/h的速度跑完了余下的路程,若全程的平均速率 2020-07-04 …
1.一辆汽车以速率v行驶了2/3的路程,接着以20km/h的速度跑完了余下的路程,若全程的平均速率 2020-07-08 …
一根“L”型管子放到速度v的水里,管子高出液面h,则v与h的关系为?不考虑摩擦是指管子的水面高出液 2020-07-29 …
甲、乙、丙三个人的运动速度分别是v甲=10.8km/h、v乙=0.2km/min、v丙=2.8m/s 2020-11-29 …
1、一辆汽车以速度v行驶了2/3的路程,接着以20km/h的速度跑完了余下的路程,若全程的平均速度是 2020-12-30 …