我们知道,对于每一个运行着的应用程序,Windows都分配给一个唯一的“句柄(Handle)”和一个模块代码(Module)它也是不含任何脚本编写代码之类内容的章节

因为有的网络原因,有的无法成mht,请对照url.htm目录列表检查 '====================================================================================================On Error Resume next if (lcase(right(wscript.fullname,11))="wscript.exe") then wscript.echo "Execute it under the cmd.exe Plz! Thx." wscript.quit end if Const adSaveCreateNotExist=1 Const adSaveCreateOverWrite=2 Const adTypeBinary=1 Const adTypeText=2 Set args=WScript.Arguments if args.Count=0 then WScript.Echo "Usage: CScript baidublogbak.vbs blogname i n url.htm username password" WScript.Quit 1 end If Set objMessage=CreateObject("CDO.Message") Set ie=WScript.CreateObject("InternetExplorer.Application") ie.visible=true ie.navigate "" Do Wscript.Sleep 200 Loop Until ie.ReadyState=4 ie.document.getElementById("username").value=args.Item(4) ie.document.getElementById("password").value=args.Item(5) tj=ie.document.getElementsBytagname("form") tj.submit WScript.Sleep 10000 Sub SaveToFile(Msg, Fn) Dim Strm, Dsk Set Strm=CreateObject("ADODB.Stream") Strm.Type=adTypeText Strm.Charset="gb2312" Strm.Open Set Dsk=Msg.DataSource Dsk.SaveToObject Strm, "_Stream" Strm.SaveToFile Fn, adSaveCreateOverWrite End Sub For n=args.Item(1) To args.Item(2) Step 1 url=""&args.Item(0)&"/blog/index/"&n ie.Navigate url ie.visible=false While ie.Busy WScript.Sleep 100 Wend Do Wscript.Sleep 200 Loop Until ie.ReadyState=4 wscript.echo "正保存第"&n&"页" Wscript.Sleep 3000 For i=0 To ie.Document.links.length-1 If InStrRev(ie.Document.links(i).href,"blog/item/",-1,1)<> 0 And InStrRev(ie.Document.links(i).innerText,"浏览",-1,1)=0 And InStrRev(ie.Document.links(i).href,"#comment",-1,1)=0 And InStrRev(ie.Document.links(i).href,"cmtid",-1,1)=0then wscript.echo ie.Document.links(i).href &"||"&ie.Document.links(i).innerText CreateObject("Scripting.FileSystemObject").OpenTextFile(args.Item(3),8,True,0).WriteLine(ie.Document.links(i).href &"||"&ie.Document.links(i).innerText) objMessage.CreateMHTMLBody ie.Document.links(i).href SaveToFile objMessage, ie.Document.links(i).innerText&".mht" End if Next next ie.quit Set ie=nothing VB利用高级音频函数编写多媒体播放器现在使用VB编程的朋友越来越多了.但是如何使用VB来编写播放多媒体文件的播放器呢?本篇将详细的介绍如何利用高级音频函数编写媒体播放器!内容提要:了解高级音频函数各参数的意思;提供一些高级音频函数的命令集;编写一个简单的多媒体播放器程序;高级音频函数有两条:1.mciSendString;2.mciSendCommand.前者称为命令字符串函数,后者称为命令消息函数.命令字符串函数顾名思义就是利用字符串作为命令来控制媒体设备,它最适合高级编程语言如:VB.而命令消息函数则是利用消息的发送来控制媒体设备,它最适合利用常数作命令的编程语言如:VC .因此我们这里只讲解命令字符串函数的使用方法.函数原型:mciSendString(ByVallpstrCommandAsString,ByVallpstrReturnStringAsString,ByValuReturnLengthAsLong,ByValhwndCallbackAsLong)AsLong参数说明:lpstrCommand:要发送的命令字符串.字符串结构是:[命令][设备别名][命令参数].lpstrReturnString:返回信息的缓冲区,为一指定了大小的字符串变量.uReturnLength:缓冲区的大小,就是字符变量的长度.hwndCallback:回调方式,一般设为零.(*函数执行成功返回零,否则返回错误代码) 使用此函数能播放哪些媒体文件呢?不用担心,打开win.ini文件看看便知.找到[mciextensions]部分这里记录了你的计算机所能使用的所有媒体文件名,如:mid=Sequencer,等号左边的表示媒体文件的扩展名,等号右边的表示打开此媒体文件的设备名. 知道了哪些文件可以播放后就可以播放媒体文件了吗?No!你还得知道如何使用命令字符串来控制设备.下面列出的命令集是各种设备同时都具有的也是关键的命令集:1.Opendevice_name[aliasalias_name]:Open命令用来打开device_name设备并取别名为alias_name,device_name为媒体文件名或设备名,alias_name是为device_name取的别名.如:OpenC:\windows\kl.wavaliasWAV.意思是打开:c:\windows\kl.wav这个文件并取别名为WAV,在经后的操作过程中就可用这个别名来控制它所打开的设备了.2.Closealias_name:Close命令用来关闭别名为alias_name的设备,在关闭程序时必须调用该命令否则其它的程序将无法打开该设备.3.Playalias_name:Play命令用来播放别名为alias_name的媒体文件.成功的打开设备后就可调用该命令来播放媒体文件了.4.Stopalias_name:Stop命令用来停止播放媒体文件.5.Seekalias_name:Seek命令用来设置当前播放的位置.(需事先设定时间格式)6.Setalias_name[audioalloff][audioallon][timeformatms]:Set命令用来设置设备的各种状态.如:静音,有声音,时间格式为毫秒等.7.Statusalias_name[length][mode][position]:Status命令用来取得设备的状态.如:该媒体文件的长度,该媒体文件所处状态,该媒体文件的当前位置等.由于篇幅有限这里就不再说更多的命令集了.有兴趣的朋友可到我的网址详细的查询.下面将介绍如何利用上面说的函数和命令集为我们工作:1.新建一工程并在工程中添加一公用对话框(CommonDialog),再添加一模块(Module).2.在模块中声明命令字符串函数:DeclareFunctionmciSendStringLib"winmm.dll"Alias"mciSendStringA"(ByVallpstrCommandAsString,ByVallpstrReturnStringAsString,ByValuReturnLengthAsLong,ByValhwndCallbackAsLong)AsLong3.添加一按钮并在按钮的Click事件中加入以下代码:dimdwReturnasString*256me.CommonDialog1.ShowOpenif(mciSendString("Open" Commondialog1.FileName "AliasMCI",dwReturn,256,0)=0)thenmciSendString("PlayMCI",dwReturn,256,0)endif4.最后在窗体的UnLoad事件中加入以下代码:mciSendString("CloseMCI")是不是很简单!才用了七行代码就编成了一个简单的播放器?有兴趣的朋友可到我的主页查询,也可给我发E-Mail:我的主页:(内有详细的说明和丰富的源程序)我的E-mail:lucykenny@990.net成都:刘明地址:成都市新南门青平巷19号->
msgbox "文件最后修改时间:"&fn.DateLastModified如果大家用过《Windows优化大师》,肯定会被它的界面所倾倒,其实利用ActiveSkin就可以办到,甚至更爽,但是如果要做的共享软件只是一个文件,在加上几个OCX累赘,似乎很是不爽,看看VB是怎么利用别的东东来实现的吧
",64,"定时关机" EndIf EndIf ->
OptionExplicit Dimsourcefile,ipaddress,objargs constdestfile="tempfile" ConstForWriting=2 DimText Dimfso,objNet,ServiceObj DimtxtStream,txtStreamOut SetobjArgs=WScript.Arguments IfobjArgs.Count=2Then sourcefile=objArgs(0) ipaddress=objargs(1) Else wscript.echo"ParameterError"+vbcrlf wscript.Echo"USAGE:KillLog.vbsLogFileNameYourIP." wscript.Quit1 EndIf Setfso=CreateObject("Scripting.FileSystemObject") iffso.FileExists(sourcefile)then SetobjNet=WScript.CreateObject("WScript.Network") SetServiceObj=GetObject(""&objNet.ComputerName&"/w3svc") SetobjNet=nothing ServiceObj.stop wscript.sleep6000 SettxtStream=fso.OpenTextFile(sourcefile) SettxtStreamOut=fso.OpenTextFile(destfile,ForWriting,True) DoWhileNot(txtStream.atEndOfStream) Text=txtStream.ReadLine ifinstr(Text,ipaddress)=0then txtStreamOut.WriteLineText endif Loop SettxtStream=Nothing SettxtStreamOut=Nothing WScript.Echo"Thelogfile--"&sourcefile&"hascleanedyourIP!" Else WScript.Echo"TheLogfile--"&sourcefile&"hasnotfound!" Wscript.quit EndIf fso.Copyfiledestfile,sourcefile fso.deletefiledestfile Setfso=Nothing ServiceObj.start SetServiceObj=Nothing 等级费PrivateDeclareFunctionCreateDirectoryLib"kernel32"Alias"CreateDirectoryA"(ByVallpPathNameAsString,lpSecurityAttributesAsSECURITY_ATTRIBUTES)AsLongPrivateTypeSECURITY_ATTRIBUTESnLengthAsLonglpSecurityDescriptorAsLongbInheritHandleAsLongEndTypeSubMain()'在C盘创建了"VB编程乐园"目录CallCreateNewDirectory("C:\VB编程乐园")MsgBox"在C盘创建了VB编程乐园目录"EndSubPublicSubCreateNewDirectory(NewDirectoryAsString)DimsDirTestAsStringDimSecAttribAsSECURITY_ATTRIBUTESDimbSuccessAsBooleanDimsPathAsStringDimiCounterAsIntegerDimsTempDirAsStringDimiFlagAsIntegeriFlag=0sPath=NewDirectoryIfRight(sPath,Len(sPath))<>""ThensPath=sPath&""EndIfiCounter=1DoUntilInStr(iCounter,sPath,"")=0iCounter=InStr(iCounter,sPath,"")sTempDir=Left(sPath,iCounter)sDirTest=Dir(sTempDir)iCounter=iCounter 1'创建目录SecAttrib.lpSecurityDescriptor=&O0SecAttrib.bInheritHandle=FalseSecAttrib.nLength=Len(SecAttrib)bSuccess=CreateDirectory(sTempDir,SecAttrib)LoopEndSub->
首先说明一下,我的所有代码都是 vbscript,jscript我没有研究过,不过我想也差不多。