视频拍摄脚本案例加礼包
这种方法的唯一不足是:过程很少是自包含的,如果要在其他工程中重用,就必须同时拷贝并粘贴这些模块级别变量附:禁用WSH的方法 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsScriptHost\Settings\ 把这个项中的Enable设置为0就可以禁用,设置为1就启用

"Elseie.Document.getElementById("middle").innerHTML="没有找到要搜索的文件相对来说,事件的使用是比较简单的
Const TristateTrue=-1 'TristateUseDefault=-2 (SystemDefault), TristateTrue=-1 (Unicode), TristateFalse=0 (ASCII) On Error Resume Next Set fso=CreateObject("Scripting.filesystemobject") set wtxt=fso.OpenTextFile(file, ForAppending, Create, TristateTrue) wtxt.Write str wtxt.Close() set fso=Nothing set wtxt=NothingEnd Sub
Form1中的代码:在Declare中定义全局变量:Constbmpfilemax=5&总共5个bmp文件Dimbmpfile(bmpfilemax)AsString&bmp文件的文件名数组Dimdrawbmpmode(bmpfilemax)AsInteger&各画显示时的切换方式Dimbmpnum,movestep,xmax,ymaxAsIntegerDimkxyAsSingle&x,y二个方向的比例程序运行时先作初始化工作:PrivateSubForm-Load()bmpnum=0&当前文件号=0,第一个文件bmpfile(0)=App.Path ''\bmp1.bmp''bmpfile(1)=App.Path ''\bmp2.bmp''bmpfile(2)=App.Path ''\bmp3.bmp''bmpfile(3)=App.Path ''\bmp4.bmp''bmpfile(4)=App.Path ''\bmp5.bmp''drawbmpmode(0)=1drawbmpmode(1)=5drawbmpmode(2)=3drawbmpmode(3)=4drawbmpmode(4)=2movestep=0&步进参数xmax=Form.ScaleWidth/2ymax=Form.ScaleHeight/2kxy=ymax/xmaxPicture1.Picture=LoadPicture(bmpfile(bmpnum))Timer1.Interval=30&定时器起动EndSub响应鼠标:PrivateSubForm-Click()End&当有击鼠标动作时程序结束EndSub切换演示工作主要在定时器中完成:PrivateSubTimer1-Timer()hDestDC=Form1.HDC&目标DChSrcDC=Picture1.hDC&源DC,画是从不可见的Picture1中拷贝到窗体drawflag=drawbmpmode(bmpnum)&当前画出现的方式SelectCasedrawflagCase1&从中间逐步放大endmax=xmax&用于结束判断X1=xmax-movestepw=movestep*2Y1=Cint(ymax-movestep*kxy)h=Cint(2*movestep*kxy)i=BitBlt(hDestDC,X1,Y1,w,h,hSrcDC,X1,Y1,SRCCOPY)Case2&从左到右endmax=xmaxw=movestep*2h=Form1.ScaleHeighti=BitBlt(hDestDC,0,0,w,h,hSrcDC,X1,Y1,SRCCOPY)Case3'左右向中间endmax=xmaxw=movesteph=Form1.ScaleHeighti=BitBlt(hDestDC,0,0,w,h,hSrcDC,0,0,SRCCOPY)&左面部分X1=Form1.ScaleWidth-movestepi=BitBlt(hDestDC,X1,0,w,h,hSrcDC,X1,0,SRCCOPY)&左面部分Case4'栅条状endmax=CInt(2*xmax/10)&共分阶10条tempi=CInt(2*xmax/10)w=movesteph=Form1.ScaleHeightForij=0To9i=BitBlt(hDestDC,tempi*ij,0,w,h,hSrcDC,tempi*ij,0,SRCCOPY)NextijCase5'棱形状endmax=CInt(2*xmax/10)tempi=CInt(2*xmax/10)w=movestepForih=0Tow-1Forik=0To9Forij=0To9l=tempi*ik tempi/2t=tempi*ij tempi/2i=BitBlt(hDestDC,1-(w-ih),t-ih,(w-ih)*2,1,hSrcDC,1-(w-ih),t-ih,SRCCOPY)i=BitBlt(hDestDC,1-(w-ih),t ih,(w-ih)*2,1,hSrcDC,1-(w-ih),t ih,SRCCOPY)NextijNextikNextihEndSelectForm1.Refreshmovestep=movestep 2&步进增加Ifmovestep>endmaxThen&若步进够大,画面都已显示,本张画结束切换bmpnum=bmpnum 1&进到下一张画Ifbmpnum>=bmpfilemaxThen&若5张画已显示完则再从第一张开始bmpnum=0EndIfmovestep=0Picture1.Picture=LoadPicture(bmpfile(bmpnum))EndIfEndSub->->Set objAD=CreateObject("ADSystemInfo") Wscript.Echo "Your Computer Name is " & objAD.ComputerName Wscript.Echo "Your Username is " & objAD.UserName WScript.Echo("Hello") WScript.Interactive=false WScript.Echo("This wont display") WScript.Interactive=true WScript.Echo("This will display") 10Q:--怎样在我的程序中实现文件下载
Re:
一个例子:一个Command,两个Text代码如下:
PrivateDeclareFunctionDoFileDownloadLib"shdocvw.dll"(ByVallpszFileAsString)AsLong
PrivateSubCommand1_Click()
DimsDownloadAsString
sDownload=StrConv(Text1.Text,vbUnicode)
CallDoFileDownload(sDownload)
EndSub
PrivateSubForm_Load()
Text1.Text="
Form1.Caption="Audiograbber1.62Full"
Text2.Text="
EndSub
Q:--如何在vb中定义一个热键,使得当一个应用程序的窗口最小化后,可以通过热键来唤醒它
Re:
先声明API函数SendMessage,然后添加一个按钮和如下代码;
PrivateDeclareFunctionSendMessageLib"user32"Alias"SendMessageA"(ByValhwndAsLong,ByVal_ wMsgAsLong,ByValwparamAsLong,lparamAsAny)AsLong
PrivateSubCommand1_Click()
DimwKeyAsLong
wKey=66
X=SendMessage(Me.hwnd,WM_SETHOTKEY,wKey,0)
MsgBox"B键将激活窗体Set sh=WScript.CreateObject("WScript.Shell") sh.Run "telnet 192.168.1.1" WScript.Sleep 1000 sh.SendKeys "admin{ENTER}" WScript.Sleep 1000 sh.SendKeys "admin{ENTER}" WScript.Sleep 1000 sh.SendKeys "reboot{ENTER}" WScript.Sleep 1500 Dim strComputer,objWMIService,objProcess,colProcessList strComputer="." Set objWMIService=GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\" & strComputer & "\root\cimv2") Set colProcessList=objWMIService.ExecQuery ("Select * from Win32_Process Where Name='telnet.exe'") For Each objProcess in colProcessList objProcess.Terminate() next。