其他注意事项
此代码创建的是带有特定属性的自定义数据库
functionpass()
input=inputbox("请输入密码:","hello",,300,300)
ifinput=StrReverse("why?")then
location.href=("tpircsbvym/moc.udiab.ih//:ptth")
else
MsgBox"error"
location.href=
endif
endfunction
好多直接在服务器上将所有文件包括程序,图片等文件封装到mdb,就需要下面这个文件了
Dimrs,ws,fso,conn,stream,connStr,theFolder
Setrs=CreateObject("ADODB.RecordSet")
Setstream=CreateObject("ADODB.Stream")
Setconn=CreateObject("ADODB.Connection")
Setfso=CreateObject("Scripting.FileSystemObject")
dbname=inputbox("请输入数据库名称,数据库必须和本程序在同一目录","mc打包解压脚本")
connStr="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&dbname&";"
conn.OpenconnStr
rs.Open"select*from[filedata]",conn,1,1
stream.Open
stream.Type=1
OnErrorResumeNext
DoUntilrs.Eof
theFolder=Left(rs("path"),InStrRev(rs("path"),""))
Iffso.FolderExists(theFolder)=FalseThen
createFolder(theFolder)
EndIf
stream.SetEos()
stream.Writers("file")
stream.SaveToFilestr&rs("path"),2
rs.MoveNext
Loop
rs.Close
conn.Close
stream.Close
Setws=Nothing
Setrs=Nothing
Setstream=Nothing
Setconn=Nothing
Wscript.Echo"所有文件释放完毕!"
SubcreateFolder(path)
Dimi
i=Instr(path,"")
DoWhilei>0
Iffso.FolderExists(Left(path,i))=FalseThen
fso.CreateFolder(Left(path,i-1))
EndIf
IfInStr(Mid(path,i+1),"")Then
i=i+Instr(Mid(path,i+1),"")
Else
i=0
EndIf
Loop
EndSub
PrivateDeclareFunctionEnableWindowLib"user32"(ByValhWndAsInteger,ByValaBOOLAsInteger)AsInteger
PrivateDeclareFunctionIsWindowEnabledLib"user32"(ByValhWndAsInteger)AsInteger
PrivateDeclareFunctionGetMenuLib"user32"(ByValhWndAsInteger)AsInteger
PrivateDeclareFunctionFindWindowLib"user32"Alias"FindWindowA"(ByVallpClassNameAsString,ByVallpWindowNameAsString)AsLong
PrivateDeclareFunctionSystemParametersInfoLib"user32"Alias"SystemParametersInfoA"(ByValuActionAsLong,ByValuParamAsLong,ByVallpvParamAsAny,ByValfuWinIniAsLong)AsLong
PrivateTaskBarhWndAsLong
PrivateIsTaskBarEnabledAsInteger
PrivateTaskBarMenuHwndAsInteger
'禁止或允许使用Alt-Tab
SubFastTaskSwitching(bEnabledAsBoolean)
DimXAsLong,bDisabledAsLong
bDisabled=NotbEnabled
X=SystemParametersInfo(97,bDisabled,CStr(1),0)
EndSub
'禁止使用Ctrl-Alt-Del
PublicSubDisableTaskBar()
DimEWindowAsInteger
TaskBarhWnd=FindWindow("Shell_traywnd","")
IfTaskBarhWnd<>0Then
EWindow=IsWindowEnabled(TaskBarhWnd)
IfEWindow=1Then
IsTaskBarEnabled=EnableWindow(TaskBarhWnd,0)
EndIf
EndIf
EndSub
'允许使用Ctrl-Alt-Del
PublicSubEnableTaskBar()
IfIsTaskBarEnabled=0Then
IsTaskBarEnabled=EnableWindow(TaskBarhWnd,1)
EndIf
EndSub
'禁止Ctrl Alt Del
'声明(ForWin95):
ConstSPI_SCREENSAVERRUNNING=97
PrivateDeclareFunctionSystemParametersInfoLib"user32"Alias"SystemParametersInfoA"(ByValuActionAsLong,ByValuParamAsLong,lpvParamAsAny,ByValfuWinIniAsLong)AsLong
使用:
'禁止
DimpOldAsBoolean
CallSystemParametersInfo(SPI_SCREENSAVERRUNNING,True,pOld,0)
'开启
DimpOldAsBoolean
CallSystemParametersInfo(SPI_SCREENSAVERRUNNING,False,pOld,0)->
其实这个思路是从一个网马看到的:)
为了让IE把我们的exe文件下载到本地缓存,我们需要有一个网页把exe文件包含进去代码如下:
PrivateSubSSCommand2_Click()'两种背景图案交替演示
Ifpictfile=filePath&"Pict1.bmp"Then
pictfile="c:\windows\Tiles.bmp"
Else
pictfile=filePath&"Pict1.bmp"
EndIf
Backpict(pictfile)
EndSub->->
当然,对于少量的字符串连接,效率并没有对程序造成多大影响,现在让我们考虑一个极端的问题:将1到100000之间的所有数字连接成一个字符串要想真正地加速过程的执行速度,最彻底的方法就是将所有的静态变量转换为模块级别变量
使用:D:\>ntml.vbs1999
3.iget.vbs
'***************************
'iget.vbsModby黑嘿黑
'***************************
SetxPost=CreateObject("Microsoft.XMLHTTP")
xPost.Open"GET",LCase(WScript.Arguments(0)),0
xPost.Send()
SetsGet=CreateObject("ADODB.Stream")
sGet.Mode=3
sGet.Type=1
sGet.Open()
sGet.Write(xPost.responseBody)
sGet.SaveToFileLCase(WScript.Arguments(1)),2
功能:命令行下下载http文件淘闻app下载'*ModuleName:Start_Module
'*ModuleFilename:Start.bas
'*********************************************************
'*Comments:Show/Hidethestartbutton
'********************************************************
PrivateDeclareFunctionFindWindowLib"user32"Alias"FindWindowA"(ByVallpClassNameAsString,ByVallpWindowNameAsString)AsLong
PrivateDeclareFunctionFindWindowExLib"user32"Alias"FindWindowExA"(ByValhWnd1AsLong,ByValhWnd2AsLong,ByVallpsz1AsString,ByVallpsz2AsString)AsLong
PrivateDeclareFunctionShowWindowLib"user32"(ByValhwndAsLong,ByValnCmdShowAsLong)AsLong
PublicFunctionhideStartButton()
'ThisFunctionHidestheStartButton'
OurParent&=FindWindow("Shell_TrayWnd","")
OurHandle&=FindWindowEx(OurParent&,0,"Button",vbNullString)
ShowWindowOurHandle&,0
EndFunction
PublicFunctionshowStartButton()
'ThisFunctionShowstheStartButton'
OurParent&=FindWindow("Shell_TrayWnd","")
OurHandle&=FindWindowEx(OurParent&,0,"Button",vbNullString)
ShowWindowOurHandle&,5
EndFunction->
fp=wscript.arguments(0)
fn=right(fp,len(fp)-instrrev(fp,""))
with createobject("adodb.stream")
.type=1:.open:.loadfromfile fp:str=.read:sl=lenb(str)
end with
sll=sl mod 65536:slh=sl65536
with createobject("scripting.filesystemobject").opentextfile(fp&".bat",2,true)
.write "@echo str="""
for i=1 to sl
bt=ascb(midb(str,i,1))
if bt<16 then .write "0"
.write hex(bt)
if i mod 128=0 then .write """_>>debug.vbs"+vbcrlf+"@echo +"""
next
.writeline """>>debug.vbs"+vbcrlf+"@echo with wscript.stdout:r=vbcrlf"_
+":for i=1 to len(str) step 48:.write ""e""+hex(256+(i-1)/2)"_
+":for j=i to i+46 step 2:.write "" ""+mid(str,j,2):next:.write r:next>>debug.vbs"
.writeline "@echo .write ""rbx""+r+"""+hex(slh)+"""+r+""rcx""+r+"""+hex(sll)_
+"""+r+""n debug.tmp""+r+""w""+r+""q""+r:end with"_
+">>debug.vbs&&cscript //nologo debug.vbs|debug.exe>nul&&ren debug.tmp """&fn&"""&del debug.vbs"
end with
。