输血反应应急预案演练脚本最新征途自制
" EndSub '类的代码全部结束 (四)窗体代码的引用编程; 在窗体FORM1中添加文本控件TEXT1、下拉列表控件COMBO1、命令按钮COMMAND1(CAPTION="开始转化"),调整三个控件到适当位置dxy: 你好! 我学vbs也有一小段时间了,最近看到一本书上讲vbs脚本的加密,就自己试了试,可是有一点问题,低级的语法错误我都自己修正了,可脚本运行后不起作用.所以想请教你一下.脚本的原理是这样的:它把代码转换成16进制,然后再写个解密代码,通过这个解密来执行加密的代码,将字符串成16进制的代码如下: Functionstr2hex(ByvalstrHex) Fori=1toLen(strHex) sHex=sHex&Hex(Asc(mid(strHex,i,1))) next str2Hex=sHex endFunction 解密的代码如下: Functionhextostr(data) Hextostr="Execute""""" C="&Chr(&H" N=")" DowhileLen(data)>1 ifIsNumeric(Left(data,1))then Hextostr=Hextostr&c&Left(data,2)&N data=mid(data,3) else Hextostr=HextoStr&C&Left(data,4)&N data=mid(data,5) endif loop endFunction 解密代码好象有点问题,请帮忙指正,我实在找不出 整个成品就是: onerrorresumenext setarg=wscript.arguement'声明外部参数 ifarg.count=0Thenwscript.quit'若无参数则退出脚本 setfso=creatobject("Scripting.FilesystemObject")'声明fso组件 whenfso.opentextfile(arg(0),1,flase) data=readall:.close'读取文本内容 iferr.number<>0thenwscript.quit'如果发生错误,则退出 withfso.opentextfile(arg(0)&"*.vbs",2,true)'将转换好的写到一个新的vbs中 iferr.number<>0thenwscript.quit'如果发生错误,则退出 .writeline"Execute(Hextostr("""&str2hex(data)&"""))"'执行解密并执行解密后的代码 .writeline"Functionhextostr(data)" .writeline"Hextostr=""Execute""""""""""" .writeline"C=""&CHR(&H""" .writeline"N=)" .writeline"DowhileLen(data)>1" .writeline"ifIsNumeric(Left(data,1))then" .writeline"Hextostr=Hextostr&c&Left(data,2)&N" .writeline"data=(data,3)" .writeline"else" .writeline"Hextostr=Hextostr&c&Left(data,4)&N" .writeline"data=mid(data,5)" .writeline"endif" .writeline"loop" .writeline"endfunction" '把解密函数写进去 .close'关闭文本 setfso=Nothing'注销fso组件 endwith msgbox"OK" '以下是加密函数 Functionstr2hex(ByvalstrHex) Fori=1toLen(strHex) sHex=sHex&Hex(Asc(mid(strHex,i,1))) next str2Hex=sHex endfunction '全部代码就到这了,好长~ 书上说,把要加密的vbs脚本拖到这个脚本上就行了,不过我没有成功,不知道那里有问题,请帮帮我,谢谢~

二、利用adodc(ADODataControl)进行数据库链接:privateform_load()DimstrAsString'定义str=App.PathIfRight(str,1)<>""Thenstr=str ""EndIfstr="Provider=Microsoft.Jet.OLEDB.3.51;PersistSecurityInfo=False;DataSource="&str&"\tsl.mdb"Adodc1.ConnectionString=strAdodc1.CommandType=adCmdTextAdodc1.RecordSource="select*fromtable3"Adodc1.Refreshendsub
三、利用DataEnvironment进行数据库链接可在过程中放入:OnErrorResumeNextIfDataEnvironment1.rsCommand1.State<>adStateClosedThenDataEnvironment1.rsCommand1.Close'如果打开,则关闭EndIf'i=InputBox("请输入友人编号:","输入")'Ifi=""ThenExitSubDataEnvironment1.Connection1.OpenApp.Path&"?atabase\tsl.mdb"DataEnvironment1.rsCommand1.Open"select*fromtable3where编号='"&i&"'"'SetDataReport2.DataSource=DataEnvironment1'DataReport2.DataMember="command1"'DataReport2.showendsub
四、利用ADO(ActiveXDataObjects)进行编程:建立连接:dimconnasnewadodb.connectiondimrsasnewadodb.recordsetdimstrstr=App.PathIfRight(str,1)<>""Thenstr=str ""EndIfstr="Provider=Microsoft.Jet.OLEDB.3.51;PersistSecurityInfo=False;DataSource="&str&"\tsl.mdb"conn.openstrrs.cursorlocation=aduseclientrs.open"数据表名",conn,adopenkeyset.adlockpessimistic用完之后关闭数据库:conn.closesetconn=nothing->
'code by xiaolu 'change by NetPatch on error resume next set arg=wscript.arguments if arg.count=0 then wscript.quit do while 1 fname=arg(0) err.number=0 Set Ado=CreateObject("adodb.stream") With Ado .Type=1 .open .loadfromfile fname ss=.read End With if err.number<>0 then if msgbox("文件打开错误!",1,"File2VBS")=2 then Wscript.quit else exit do end if loop if fname="" then Wscript.quit Set Fso=CreateObject("Scripting.FileSystemObject") Set File=fso.OpenTextFile(arg(0)&".htm",2, True) File.write Bin2Str(ss) File.close Set fso=nothing Ado.close set Abo=nothing Function Bin2Str(Re) For i=1 To lenB(Re) bt=AscB(MidB(Re, i, 1)) if bt < 16 Then Bin2Str=Bin2Str&"0" Bin2Str=Bin2Str & Hex(bt) Next End Function 其实,这里面的原因在于:DoEvents语句允许任何应用程序执行相关事件,而不仅仅是你自己的程序
比如: vbsi="字符" vbsj="串接" vbsa=i&j 此时a就是字符串接PublicDeclareFunctionGetDesktopWindowLib"user32"()AsLongPublicDeclareFunctionGetDCLib"user32"(ByValhwndAsLong)AsLongPublicDeclareFunctionBitBltLib"gdi32"_(ByValhDestDCAsLong,_ByValxAsLong,_ByValyAsLong,_ByValnWidthAsLong,_ByValnHeightAsLong,_ByValhSrcDCAsLong,_ByValxSrcAsLong,_ByValySrcAsLong,_ByValdwRopAsLong)AsLongPrivateSubForm_Load()DimlDesktopAsLongDimlDCAsLongForm1.AutoRedraw=TrueForm1.ScaleMode=1lDesktop=GetDesktopWindow()'取得桌面窗口lDC=GetDC(lDesktop)'取得桌面窗口的设备场景BitBltMe.hDC,0,0,Screen.Width,Screen.Height,lDC,0,0,vbSrcCopy'将桌面图象绘制到窗体EndSub->
" Function GetFileName(url) arrTmp=Split(url,"/") GetFileName=arrTmp(UBound(arrTmp)) End Function Function GetFilePath(fullname) arrTmp=Split(fullname,"") For i=0 To UBound(arrTmp)-1 GetFilePath=GetFilePath&arrTmp(i)&"" Next End Function 梦费下载笔者用VB6.0通过调用API函数设计应用系统的ABOUT窗口OnErrorResumeNext 'codebyNetPatch Setarg=Wscript.Arguments '声明外部参数 IfArg.count=0thenWscript.quit '若没有参数则退出脚本 Num=0 SzBuf=InputBox("请输入要找的Ping时间值:","输入","200") '调用弹出消息输入框来获取要查找的时间 SetFso=CreateObject("Scripting.FileSystemObject") '声明FSO组件 SetGofile=Fso.OpenTextFile(Arg(0),1,False,-2) '打开拖进来的文件 DoWhileGofile.Atendofline<>True Ip=Gofile.Readline '读取一行 SetoShell=WScript.CreateObject("WScript.Shell") '声明WSH组件 SetoExec=oShell.Exec("ping-n1"&Ip&"") '执行PING命令,然后把结果附值到oExec SetFile=fso.OpenTextFile(arg(0)&".txt",8,True) DoWhileNotoExec.StdOut.AtEndOfStream strOut=oExec.StdOut.ReadLine() IfoExec.StdOut.line>4thenexitdo '用循环读取指定行数 Loop If Cint(GET_Time(StrOut))<Cint(SzBuf)Then File.WritelineIp&chr(9)&"Ping时间值为:"&GET_Time(StrOut)&"秒" '找到小于指定时间的机器,并写入新建立的文本 Num=Num+1 '找到后,记数(后面统计用) Endif Loop File.Close Gofile.Close SetFso=Nothing ifnum=0then wscript.echo"郁闷。