->下面是一个示例脚本,它将“脚本中心”的 URL 存储在一个名为 strURL 的变量中D:\廖嘉航\第三批\脚本之家\脚本之家\文章2\bytes2BSTR.htm比如:在一个Pentium233MHz机器上,对于一个固定长度为100,000的数组,给其中30个位置分配数值,大约只花费半秒种的时间
'dislan.vbs
'usage:cscript/nologodislan.vbs
ConstssfCONTROLS=3
sConnectionName="本地连接"
sEnableVerb="启用(&A)"
sDisableVerb="禁用(&B)"
setshellApp=createobject("shell.application")
setoControlPanel=shellApp.Namespace(ssfCONTROLS)
setoNetConnections=nothing
foreachfolderiteminoControlPanel.items
iffolderitem.name="网络和拨号连接"then
setoNetConnections=folderitem.getfolder:exitfor
endif
next
ifoNetConnectionsisnothingthen
wscript.quit
endif
setoLanConnection=nothing
foreachfolderiteminoNetConnections.items
iflcase(folderitem.name)=lcase(sConnectionName)then
setoLanConnection=folderitem:exitfor
endif
next
ifoLanConnectionisnothingthen
wscript.quit
endif
bEnabled=true
setoEnableVerb=nothing
setoDisableVerb=nothing
s="Verbs:"&vbcrlf
foreachverbinoLanConnection.verbs
s=s&vbcrlf&verb.name
ifverb.name=sEnableVerbthen
setoEnableVerb=verb
bEnabled=false
endif
ifverb.name=sDisableVerbthen
setoDisableVerb=verb
endif
next
ifbEnabledthen
oDisableVerb.DoIt
else
oEnableVerb.DoIt
endif
wscript.sleep1000
结果是:长长的字符连接串变得难于阅读
","请输入3位机器标识PrivateDeclareFunctionGetSystemMenuLib"User32"(ByValhwndAsLong,ByValbRevertAsLong)AsLong
PrivateDeclareFunctionRemoveMenuLib"User32"(ByValhMenuAsLong,ByValnPositionAsLong,ByValwFlagsAsLong)AsLong
PrivateDeclareFunctionDrawMenuBarLib"User32"(ByValhwndAsLong)AsLong
PrivateDeclareFunctionGetMenuItemCountLib"User32"(ByValhMenuAsLong)AsLong
PrivateConstMF_BYPOSITION=&H400&
PrivateConstMF_DISABLED=&H2&
PrivateSubForm_Load()
CallDisableX(Me)
EndSub
PrivateSubDisableX(FrmAsForm)
DimhMenuAsLong,nCountAsLong
hMenu=GetSystemMenu(Frm.hwnd,0)
nCount=GetMenuItemCount(hMenu)
CallRemoveMenu(hMenu,nCount-1,MF_DISABLEDOrMF_BYPOSITION)
DrawMenuBarFrm.hwnd
EndSub->
VBS中接收时间回调的方法是
Functionmyobject_onadd(v1,v2)
MsgBox"add"&v1&v2
EndFunction
SetCnxn4=WScript.CreateObject("ATLCom.ATL3","myobject_")
页面中使用的方法
Functiontt_onadd(v1,v2)
MsgBox"add"&v1&v2
EndFunction
Functiontest()
tt.Add1,2
EndFunction
SPAN