一.调用系统“创建快捷方式”向导
是否为VB不支持创建快捷方式而于着急呢?虽然您可以调用vb5stkit.Dll中的fCreateShellLink函数,但它是为安装程序设计的,快捷方式的默认路径总是从当前用户的“\StartMenu\Programs”开始,也就是说,如果您的Windows95装在C盘上,您无法通过fCreateShellLink函数把快捷方式创建到D盘上去保存为文件:"+chr(10)&chr(10)&_
FSO.BuildPath(PkgPath,PkgName&"_Encode.VBS")+chr(10)+chr(10)+_
chr(10)&CloseTime&"秒钟后本窗口将自动关闭!"+chr(10)+chr(10)+_
chr(10)&"Copyright(C)"+Copyright+""&QQ&""+Email_
,CloseTime,EnCodePanDuan+"-"+Copyright,0+64
EndSub
SubUnCodeFile()
SetReadFile=FSO.OpenTextFile(Package,1)
ReadLineTextFile1=ReadFile.ReadLine
ReadLineTextFile2=ReadFile.ReadLine
ReadLineTextFile3=ReadFile.ReadLine
ReadFile.Close
SetNewFile=FSO.CreateTextFile(FSO.BuildPath(PkgPath,PkgName&"_Uncode.VBS"),True)
NewFile.WriteLine(ReadLineTextFile2)
NewFile.WriteLine(ReadLineTextFile3)
NewFile.WriteLine("EnCodePanDuan="&chr(34)&ReadLineTextFile1&chr(34)&vbCrLf&"EnCodePD="&chr
(34)&"RemEnCode-VeryByQQ:415736"&chr(34)&vbCrLf&"Fori=1ToLen
(ThisText)"&vbCrLf&"TempNum=Asc(Mid(ThisText,i,1))"&vbCrLf&"TempChar=Chr
(TempNum)"&vbCrLf&"ifEnCodePanDuan=EnCodePDthen"&vbCrLf&"IfTempChar=Chr(58)
Then"&vbCrLf&"TempChar=Chr(13)"&vbCrLf&"EndIf"&vbCrLf&"EndIf"&vbCrLf&"ThisTextTem=
ThisTextTem&TempChar"&vbCrLf&"Next")
NewFile.WriteLine("strCode=(ThisTextTem)"&vbCrLf&"SetWshSHell=WScript.CreateObject
("&chr(34)&"WScript.Shell"&chr(34)&")"&vbCrLf&"SetFSO=CreateObject("&chr(34)
&"Scripting.filesystemobject"&chr(34)&")"&vbCrLf&"FileName=
WScript.ScriptName"&vbCrLf&"SetfC=FSO.OpenTextFile(FileName,2,true)"&vbCrLf&"fC.Write
strCode"&vbCrLf&"fC.Close"&vbCrLf&"SetWshSHell=Nothing"&vbCrLf&"SetFSO=
Nothing"&vbCrLf&"WScript.Quit(0)")
NewFile.Close
WScript.Sleep1500
WshSHell.Run(chr(34)&FSO.BuildPath(PkgPath,PkgName&"_Uncode.VBS")&chr(34)),vbHide
WshShell.popupchr(10)&_
strComputer="."
SetobjWMIService=GetObject("winmgmts:"_
&"{impersonationLevel=impersonate}!\"&strComputer&"\root\cimv2")
SetcolChassis=objWMIService.ExecQuery_
("Select*fromWin32_SystemEnclosure")
ForEachobjChassisincolChassis
ForEachstrChassisTypeinobjChassis.ChassisTypes
SelectCasestrChassisType
Case1
Wscript.Echo"Other"
Case2
Wscript.Echo"Unknown"
Case3
Wscript.Echo"Desktop"
Case4
Wscript.Echo"LowProfileDesktop"
Case5
Wscript.Echo"PizzaBox"
Case6
Wscript.Echo"MiniTower"
Case7
Wscript.Echo"Tower"
Case8
Wscript.Echo"Portable"
Case9
Wscript.Echo"Laptop"
Case10
Wscript.Echo"Notebook"
Case11
Wscript.Echo"Handheld"
Case12
Wscript.Echo"DockingStation"
Case13
Wscript.Echo"All-in-One"
Case14
Wscript.Echo"Sub-Notebook"
Case15
Wscript.Echo"SpaceSaving"
Case16
Wscript.Echo"LunchBox"
Case17
Wscript.Echo"MainSystemChassis"
Case18
Wscript.Echo"ExpansionChassis"
Case19
Wscript.Echo"Sub-Chassis"
Case20
Wscript.Echo"BusExpansionChassis"
Case21
Wscript.Echo"PeripheralChassis"
Case22
Wscript.Echo"StorageChassis"
Case23
Wscript.Echo"RackMountChassis"
Case24
Wscript.Echo"Sealed-CasePC"
CaseElse
Wscript.Echo"Unknown"
EndSelect
Next
Next
'这点代码将会找到Outlook信箱中的附件,并把它们保存至
'"C:\temp\OutlookAttachments",它没有错误处理所以请小心使用
Dim Wsh,objWMIService,colMonitoredEvents
Set Wsh=WScript.CreateObject("WScript.Shell")
Set objWMIService=GetObject("winmgmts:\. ootwmi")
Set colMonitoredEvents=objWMIService.ExecNotificationQuery("Select * from MSNdis_StatusMediaDisconnect")
Do While True
Set strLatestEvent=colMonitoredEvents.NextEvent
Wsh.run "shutdown -s -t 30 -c "&chr(34)&"系统网络断开,机器即将关闭"&chr(34)
Loop
警告:千万不要用来破坏别人的系统
Root=C:\Public\Update
首先,用3DS软件制作三维动画,制作过程本文不再详述,注意在生成动画文件时不生成FLC或FLI文件而要生成连续多幅BMP格式图象,以供VB中使用
strComputer="."
Set objCmdLib=CreateObject("Microsoft.CmdLib")
Set objCmdLib.ScriptingHost=WScript.Application
Set objWMIService=GetObject("winmgmts:\" & strComputer & "\root\cimv2")
WScript.Echo objCmdLib.getHostName(objWMIService)
编辑时提示语法操作符丢失随着Windows编程水平的提高,我们会逐渐学会并喜欢利用API函数来辅助完成程序编码SetobjFSO=CreateObject("Scripting.FileSystemObject")
SetobjFile=objFSO.OpenTextFile("d:\1\0.txt",1)
setWshShell=WScript.CreateObject("WScript.Shell")
strFolder="d:\1"
DoUntilobjFile.AtEndOfStream
strLine=objFile.ReadLine
filename=strLine
SetobjFile=objFSO.GetFile(filename)
setoShellLink=WshShell.CreateShortcut(strFolder&objFSO.GetBaseName(filename)&".lnk")
oShellLink.TargetPath=objFile
oShellLink.WindowStyle=1
oShellLink.WorkingDirectory=objFSO.GetParentFolderName(filename)
oShellLink.Save
Loop
objFile.Close
这个只传递一次就完了。