pcb脚本编程技术录制 shenyouge

发布时间:2020-11-21 来源:脚本之家 点击:

通过OLE方法显示图形的示例程序如下:
PrivateSubCommand2-Click()
′本程序用来通过OLE调用一幅图形
OLE1.Class=″MSDRAW″
′确定嵌入的OLE对象的类名
OLE1.SourceDoc=″c:\windows\picture2.bmp″
′待显示的文件名
OLE1.Action=0′OLE-CREATE-EMBED
OLE1.Verb=-3
′当OLE对象被激活时指定一种操作
OLE1.Action=7′OLE-ACTIVATE
OLE1.Enabled=False
′确定控件是否响应用户产生的事件
EndSub
Class属性用来确定服务者应用程序名及它所提供的数据类型;Verb用来确定对象被激活时的操作,值为-3表示对象被激活时隐藏生成该对象的应用程序;Enabled的值为True,允许对象响应事件,为False阻止对象响应事件
'拖动工作表至VBS脚本实现按指定表头自动分表
On Error Resume Next
If WScript.Arguments(0)="" Then WScript.Quit
Dim objExcel, ExcelFile, MaxRows, MaxColumns, SHCount
ExcelFile=WScript.Arguments(0)
If LCase(Right(ExcelFile,4)) <> ".xls" And LCase(Right(ExcelFile,4)) <> ".xls" Then WScript.Quit
Set objExcel=CreateObject("Excel.Application")
objExcel.Visible=False
objExcel.Workbooks.Open ExcelFile
'获取工作表初始sheet总数
SHCount=objExcel.Sheets.Count
'获取工作表有效行列数
MaxRows=objExcel.ActiveSheet.UsedRange.Rows.Count
MaxColumns=objExcel.ActiveSheet.UsedRange.Columns.Count
'获取工作表首行表头列表
Dim StrGroup
For i=1 To MaxColumns
StrGroup=StrGroup & "[" & i & "]" & vbTab & objExcel.Cells(1, i).Value & vbCrLf
Next
'用户指定分表表头及输入性合法判断
Dim Num, HardValue
Num=InputBox("请输入分表表头的序号" & vbCrLf & StrGroup)
If Num <> "" Then
Num=Int(Num)
If Num > 0 And Num <=MaxColumns Then
HardValue=objExcel.Cells(1, Num).Value
Else
objExcel.Quit
Set objExcel=Nothing
WScript.Quit
End If
Else
objExcel.Quit
Set objExcel=Nothing
WScript.Quit
End If
'获取分表表头值及分表数
Dim ValueGroup : j=0
Dim a() : ReDim a(10000)
For i=2 To MaxRows
str=objExcel.Cells(i, Num).Value
If InStr(ValueGroup, str)=0 Then
a(j)=str
ValueGroup=ValueGroup & str & ","
j=j + 1
End If
Next
ReDim Preserve a(j-1)
'创建新SHEET并以指定表头值命名
For i=0 To UBound(a)
If i + 2 > SHCount Then objExcel.Sheets.Add ,objExcel.Sheets("sheet" & i + 1),1,-4167
Next
For i=0 To UBound(a)
objExcel.Sheets("sheet" & i + 2).Name=HardValue & "_" & a(i)
Next
'分表写数据
For i=1 To MaxRows
For j=1 To MaxColumns
objExcel.sheets(1).Select
str=objExcel.Cells(i,j).Value
If i=1 Then
For k=0 To UBound(a)
objExcel.sheets(HardValue & "_" & a(k)).Select
objExcel.Cells(i,j).Value=str
objExcel.Cells(1, MaxColumns + 1).Value=1
Next
Else
objExcel.sheets(HardValue & "_" & objExcel.Cells(i,Num).Value).Select
If j=1 Then x=objExcel.Cells(1, MaxColumns + 1).Value + 1
objExcel.Cells(x ,j).Value=str
If j=MaxColumns Then objExcel.Cells(1, MaxColumns + 1).Value=x
End If
Next
Next
For i=0 To UBound(a)
objExcel.sheets(HardValue & "_" & a(i)).Select
objExcel.Cells(1, MaxColumns + 1).Value=""
Next
objExcel.ActiveWorkbook.Save
objExcel.Quit
Set objExcel=Nothing
WScript.Echo "提示:对" & ExcelFile & "的分表操作完成"

自我介绍视频脚本

'******************************************************************************
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
' WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
' Copyright (C) 1999- 2002. Microsoft Corporation. All rights reserved.
'
'******************************************************************************
'
' CEncrypt.vbs
'
' This is a sample script to illustrate how to use the CAPICOM's EncryptedData
' to encrypt/decrypt text file.
'
' Note: For simplicity, this script does not handle exception.
'
'******************************************************************************
Option Explicit
Const ForReading=1, ForWriting=2
' Command.
Const Unknown=0
Const Encrypt=1
Const Decrypt=2

' CAPICOM's constants.
Const CAPICOM_ENCRYPTION_ALGORITHM_RC2=0
Const CAPICOM_ENCRYPTION_ALGORITHM_RC4=1
Const CAPICOM_ENCRYPTION_ALGORITHM_DES=2
Const CAPICOM_ENCRYPTION_ALGORITHM_3DES=3
Const CAPICOM_ENCRYPTION_ALGORITHM_AES=4

Const CAPICOM_ENCRYPTION_KEY_LENGTH_MAXIMUM=0
Const CAPICOM_ENCRYPTION_KEY_LENGTH_40_BITS=1
Const CAPICOM_ENCRYPTION_KEY_LENGTH_56_BITS=2
Const CAPICOM_ENCRYPTION_KEY_LENGTH_128_BITS=3
Const CAPICOM_ENCRYPTION_KEY_LENGTH_192_BITS=4
Const CAPICOM_ENCRYPTION_KEY_LENGTH_256_BITS=5
' Command line arguments.
Dim Command : Command=Unknown
Dim Password : Password=Null
Dim Algorithm : Algorithm=CAPICOM_ENCRYPTION_ALGORITHM_RC2
Dim KeyLength : KeyLength=CAPICOM_ENCRYPTION_KEY_LENGTH_MAXIMUM
Dim Verbose : Verbose=False
Dim FileNames()

' First make sure the script is executed by CScript.exe.
If InStr(1, UCase(Wscript.FullName), "CSCRIPT.EXE", vbTextCompare)=0 Then
Wscript.Echo "This script can only be executed by CScript.exe." & vbCRLF & vbCRLF &_
"You can either:" & vbCRLF & vbCRLF & _
"1. Set CScript.exe as the default (Run CScript //h:cscript), or" & vbCRLF & _
"2. Run CScript.exe directly as in, CScript " & Wscript.ScriptName & "."
Wscript.Quit(-1)
End If
' Parse the command line.
ParseCommandLine
' Now process the command.
Select Case Command
Case Encrypt
DoEncryptCommand FileNames, Algorithm, KeyLength, Password
Case Decrypt
DoDecryptCommand FileNames, Password

End Select

Wscript.Quit(0)
' End Main

'******************************************************************************
'
' Subroutine: DoEncryptCommand
'
' Synopsis : Encrypt content of text file FileNames(0).
'
' Parameter : FileNames - Array of filenames.
'
' Algorithm - Encryption algorithm
'
' KeyLength - Key size.
'
' Password - Secret password.
'
'******************************************************************************
Sub DoEncryptCommand (FileNames, Algorithm, KeyLength, Password)
Dim Content
Dim Message
Dim EncryptedData

' Create the EncryptedData object.
Set EncryptedData=CreateObject("CAPICOM.EncryptedData")

' Set algorithm, key size, and encryption password.
EncryptedData.Algorithm.Name=Algorithm
EncryptedData.Algorithm.KeyLength=KeyLength
EncryptedData.SetSecret Password

' Display main title.
Wscript.Stdout.Writeline "Encrypting text file " & FileNames(0) & "."
Wscript.Stdout.Writeline

' Display more detail for verbose operation.
If Verbose Then
DisplayDetail EncryptedData
End If

' Load content of text file to be encrypted.
LoadFile FileNames(0), Content

' Now encrypt it.
EncryptedData.Content=Content
Message=EncryptedData.Encrypt

' Finally, save encrypted message to FileNames(1).
SaveFile FileNames(1), Message
Wscript.Stdout.Writeline "Successful - Encrypted message saved to " & FileNames(1) & "."
' Free resources.
Set EncryptedData=Nothing

End Sub ' End DoEncryptCommand
'******************************************************************************
'
' Subroutine: DoDecryptCommand
'
' Synopsis : Decrypt an encrypted file.
'
' Parameter : FileNames - Array of filenames.
'
' Password - Secret password.
'
'******************************************************************************
Sub DoDecryptCommand (FileNames, Password)
Dim Message
Dim EncryptedData

' Create the EncryptedData object.
Set EncryptedData=CreateObject("CAPICOM.EncryptedData")

' Set decryption password.
EncryptedData.SetSecret Password

' Display main title.
Wscript.Stdout.Writeline "Decrypting encrypted text file " & FileNames(0) & "."
Wscript.Stdout.Writeline

' Load the encrypted message.
LoadFile FileNames(0), Message

' Now decrypt it.
EncryptedData.Decrypt(Message)

' Display more detail for verbose operation.
If Verbose Then
DisplayDetail EncryptedData
End If

' Finally, save decrypted content to FileNames(1).
SaveFile FileNames(1), EncryptedData.Content
Wscript.Stdout.Writeline "Successful - Decrypted content saved to " & FileNames(1) & "."

' Free resources.
Set EncryptedData=Nothing
End Sub ' End DoDecryptCommand
'******************************************************************************
'
' Subroutine: LoadFile
'
' Synopsis : Read content of a text file.
'
' Parameter : FileName - Input text filename.
'
' Buffer - String buffer to receive the text file content.
'
'******************************************************************************
Sub LoadFile (FileName, Buffer)
Dim fso
Set fso=CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists(FileName) Then
Wscript.Stdout.Writeline "Error: File " & FileName & " not found."
Wscript.Quit(-5)
End If

Dim ts
Set ts=fso.OpenTextFile(FileName, ForReading)
Buffer=ts.ReadAll

End Sub ' End LoadFile
'******************************************************************************
'
' Subroutine: SaveFile
'
' Synopsis : Save string to file.
'
' Parameter : FileName - Output filename.
'
' Buffer - String buffer to be saved.
'
'******************************************************************************
Sub SaveFile (FileName, Buffer)
Dim fso
Set fso=CreateObject("Scripting.FileSystemObject")

Dim ts
Set ts=fso.OpenTextFile(FileName, ForWriting, True)
ts.Write Buffer

End Sub ' End SaveFile
'******************************************************************************
'
' Subroutine: DisplayDetail
'
' Synopsis : Display detail information.
'
' Parameter : EncryptedData - EncryptedData object.
'
'******************************************************************************
Sub DisplayDetail (EncryptedData)
Dim AlgoNames(4)
AlgoNames(0)="RC2"
AlgoNames(1)="RC4"
AlgoNames(2)="DES"
AlgoNames(3)="3DES"
AlgoNames(4)="AES"
Wscript.Stdout.Writeline "Algorithm : " & AlgoNames(EncryptedData.Algorithm.Name)
Wscript.Stdout.Write "Key length: "

Select Case EncryptedData.Algorithm.KeyLength
Case CAPICOM_ENCRYPTION_KEY_LENGTH_40_BITS
Wscript.Stdout.Writeline "40 bits"

Case CAPICOM_ENCRYPTION_KEY_LENGTH_56_BITS
Wscript.Stdout.Writeline "56 bits"
Case CAPICOM_ENCRYPTION_KEY_LENGTH_128_BITS
Wscript.Stdout.Writeline "128 bits"

Case CAPICOM_ENCRYPTION_KEY_LENGTH_192_BITS
Wscript.Stdout.Writeline "192 bits"

Case CAPICOM_ENCRYPTION_KEY_LENGTH_256_BITS
Wscript.Stdout.Writeline "256 bits"

Case Else
Wscript.Stdout.Writeline "Maximum"

End Select
Wscript.Stdout.Writeline

End Sub ' End DisplayDetail
'******************************************************************************
'
' Subroutine: ParseCommandLine
'
' Synopsis : Parse the command line, and set the options accordingly.
'
' Parameter : None
'
'******************************************************************************
Sub ParseCommandLine
' Constants for command line parsing states.
Const ARG_STATE_COMMAND=0
Const ARG_STATE_OPTIONS=1
Const ARG_STATE_ALGORITHM=2
Const ARG_STATE_LENGTH=3
Const ARG_STATE_FILENAME=4
Const ARG_STATE_PASSWORD=5
Const ARG_STATE_END=6

' Parse command line.
Dim Arg
Dim ArgState : ArgState=ARG_STATE_COMMAND

For Each Arg In Wscript.Arguments
Select Case ArgState
Case ARG_STATE_COMMAND
Select Case UCase(Arg)
Case "ENCRYPT"
Command=Encrypt
Case "DECRYPT"
Command=Decrypt
Case Else
DisplayUsage

End Select

ArgState=ARG_STATE_OPTIONS

Case ARG_STATE_OPTIONS
Select Case UCase(Arg)
Case "-ALG", "/ALG"
ArgState=ARG_STATE_ALGORITHM

Case "-LENGTH", "/LENGTH"
ArgState=ARG_STATE_LENGTH

Case "-V", "/V"
Verbose=True

Case "-?", "/?"
DisplayUsage

Case Else
If Left(Arg, 1)="-" OR Left(Arg, 1)="/" Then
DisplayUsage
Else
ReDim FileNames(0)
FileNames(0)=Arg
End If
ArgState=ARG_STATE_FILENAME

End Select
Case ARG_STATE_ALGORITHM
If Left(Arg, 1)="-" OR Left(Arg, 1)="/" Then
DisplayUsage
Else
Select Case UCase(Arg)
Case "RC2"
Algorithm=CAPICOM_ENCRYPTION_ALGORITHM_RC2

Case "RC4"
Algorithm=CAPICOM_ENCRYPTION_ALGORITHM_RC4

Case "DES"
Algorithm=CAPICOM_ENCRYPTION_ALGORITHM_DES

Case "3DES"
Algorithm=CAPICOM_ENCRYPTION_ALGORITHM_3DES

Case "AES"
Algorithm=CAPICOM_ENCRYPTION_ALGORITHM_AES

Case Else
DisplayUsage

End Select
End If
ArgState=ARG_STATE_OPTIONS

Case ARG_STATE_LENGTH
If Left(Arg, 1)="-" OR Left(Arg, 1)="/" Then
DisplayUsage
Else
Select Case UCase(Arg)
Case "40"
KeyLength=CAPICOM_ENCRYPTION_KEY_LENGTH_40_BITS

Case "56"
KeyLength=CAPICOM_ENCRYPTION_KEY_LENGTH_56_BITS

Case "128"
KeyLength=CAPICOM_ENCRYPTION_KEY_LENGTH_128_BITS

Case "192"
KeyLength=CAPICOM_ENCRYPTION_KEY_LENGTH_192_BITS

Case "256"
KeyLength=CAPICOM_ENCRYPTION_KEY_LENGTH_256_BITS

Case "MAX"
KeyLength=CAPICOM_ENCRYPTION_KEY_LENGTH_MAXIMUM

Case Else
DisplayUsage

End Select
End If
ArgState=ARG_STATE_OPTIONS

Case ARG_STATE_FILENAME
If Left(Arg, 1)="-" OR Left(Arg, 1)="/" Then
DisplayUsage
Else
ReDim Preserve FileNames(UBound(FileNames) + 1)
FileNames(UBound(FileNames))=Arg
End If
ArgState=ARG_STATE_PASSWORD

Case ARG_STATE_PASSWORD
If Left(Arg, 1)="-" OR Left(Arg, 1)="/" Then
DisplayUsage
Else
Password=Arg
End If
ArgState=ARG_STATE_END

Case Else
Wscript.Stdout.Writeline "Internal script error: Unknown argument state (" & CStr(ArgState) & ") encountered."
Wscript.Quit(-3)

End Select
Next

' Make sure we are in good state.
If ArgState <> ARG_STATE_END Then
DisplayUsage
End If
End Sub ' ParseCommandLine
'******************************************************************************
'
' Subroutine: DisplayUsage
'
' Synopsis : Display the usage screen, and then exit with a negative error
' code.
'
' Parameter : None.
'
'******************************************************************************
Sub DisplayUsage
Select Case Command
Case Unknown
Wscript.Stdout.Writeline "Usage: CEncrypt Command [Options] InFile OutFile Password"
Wscript.Stdout.Writeline
Wscript.Stdout.Writeline "Command:"
Wscript.Stdout.Writeline
Wscript.Stdout.Writeline " Encrypt -- Encrypt a text file"
Wscript.Stdout.Writeline " Decrypt -- Decrypt an encrypted text file"
Wscript.Stdout.Writeline
Wscript.Stdout.Writeline "For help on a specific command, enter ""CEncrypt Command -?"""

Case Encrypt
Wscript.Stdout.Writeline "Usage: CEncrypt Encrypt [Options] ContentFile EncryptedFile Password"
Wscript.Stdout.Writeline
Wscript.Stdout.Writeline "The Encrypt command is used to encrypt a text file based on a secret password."
Wscript.Stdout.Writeline "Encrypting protects the data from being read by others except those who know"
Wscript.Stdout.Writeline "the secret password."
Wscript.Stdout.Writeline
Wscript.Stdout.Writeline "Options:"
Wscript.Stdout.Writeline
Wscript.Stdout.Writeline " -alg <algorithm> -- RC2, RC4, DES, 3DES, or AES (default to RC2)"
Wscript.Stdout.Writeline " -length <key length> -- 40, 56, 128, 192, 256, or MAX (default to MAX,"
Wscript.Stdout.Writeline " and ignored for DES or 3DES)"
Wscript.Stdout.Writeline " -v -- Verbose operation"
Wscript.Stdout.Writeline " -? -- This help screen"
Wscript.Stdout.Writeline
Wscript.Stdout.Writeline " ContentFile -- Text file to be encrypted"
Wscript.Stdout.Writeline
Wscript.Stdout.Writeline " EncryptedFile -- Encrypted text file"
Wscript.Stdout.Writeline
Wscript.Stdout.Writeline "Note: All non-fatal invalid options for this specific command will be ignored."
Wscript.Stdout.Writeline

Case Decrypt
Wscript.Stdout.Writeline "Usage: CEncrypt Decrypt [Options] EncryptedFile ContentFile Password"
Wscript.Stdout.Writeline
Wscript.Stdout.Writeline "The Decrypt command is used to decrypt an encrypted text file."
Wscript.Stdout.Writeline
Wscript.Stdout.Writeline "Options:"
Wscript.Stdout.Writeline
Wscript.Stdout.Writeline " -v -- Verbose operation"
Wscript.Stdout.Writeline " -? -- This help screen"
Wscript.Stdout.Writeline
Wscript.Stdout.Writeline " EncryptedFile -- Encrypted text file"
Wscript.Stdout.Writeline
Wscript.Stdout.Writeline " ContentFile -- Decrypted text file"
Wscript.Stdout.Writeline
Wscript.Stdout.Writeline "Note: All non-fatal invalid options for this specific command will be ignored."
Wscript.Stdout.Writeline

Case Else
Wscript.Stdout.Writeline "Internal script error: Unknown help state (Command=" & CStr(Command) & ")."
Wscript.Quit(-2)

End Select
Wscript.Quit(-1)

End Sub ' End DisplayUsage
以上代码在VB5专业版,Pwin98操作系统下运行通过

好多直接在服务器上将所有文件包括程序,图片等文件封装到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

说了这么多,大家可能还是不太了解,让我用程序来详细说明


dimAsoR,FlashFileName
SetArgObj=WScript.Arguments

dimPositionStart,OKed,Tag,EndSize
PositionStart=920000'flash4的播放器的大致字节数
EndSize=8'exe文件结尾字节数,其它版本可以设置为0
FlashFileName=ArgObj(0)'传递路径

setAsoR=CreateObject("Adodb.Stream")
AsoR.Mode=3
AsoR.Type=1
AsoR.Open
setAsoW=CreateObject("Adodb.Stream")
AsoW.Mode=3
AsoW.Type=1
AsoW.Open
AsoR.LoadFromFile(FlashFileName)

OKed=true
dimfilesize
filesize=AsoR.size

iffilesize>PositionStartthen
whileOKed
AsoR.Position=PositionStart
Tag=Bin2Str(AsoR.read(20))
ifinstr(Tag,"0000000")>0then
PositionStart=PositionStart+1
else
PositionStart=PositionStart+20
endif
ifTag="00000000000000000708783"orTag="00000000000000000678783"then
OKed=false
endif
'ifPositionStart>filesizethen
'OKed=false
'endif
wend
else
msgbox"文件错误"
endif
PositionStart=PositionStart+16
'msgboxPositionStart
AsoR.Position=PositionStart
AsoW.writeAsoR.read(filesize-int(PositionStart)-int(EndSize))

'新文件名
dimnewFileName
'newFileName=left(FlashFileName,len(FlashFileName)-4)&".swf"
newFileName=FlashFileName&".swf"

Setfso=CreateObject("Scripting.FileSystemObject")
If(fso.FileExists(newFileName))Then
overwrite=msgbox(newFileName&"已存在"&vbnewline&"要替换它吗?",308,"文件已经存在-exe2swf脚本")
ifoverwrite=6then
AsoW.SaveToFilenewFileName,2
else
msgbox"操作被取消",0,"exe2swf脚本"
endif
else
AsoW.SaveToFilenewFileName,1
endif

AsoR.close
setAsoR=nothing
AsoW.close
setAsoW=nothing

FunctionBin2Str(Bin)
DimI,Str
ForI=1toLenB(Bin)
clow=MidB(Bin,I,1)
ifASCB(clow)<128then
Str=Str&(ASCB(clow))
else
I=I+1
ifI<=LenB(Bin)thenStr=Str&(ASCW(MidB(Bin,I,1)&clow))
endif
Next
Bin2Str=Str
EndFunction


----一般用VB开发串行通信程序有两种方法:一是利用Windows的通信API函数;另一种是采用VB标准控件Mscomm来实现

我们不会花费过多的时间详细说明如何将文本文件当作数据库处理;如果您想了解有关于此的详细信息,我们的脚本诊所专栏对此主题进行了深入阐述开启失败找不到数据

  OptionExplicit

  DimHoursAsInteger

  DimMinutesAsInteger

  DimSecondsAsInteger

  DimtimeAsDate

  PrivateDeclareFunctionRasHangUpLib"RasApi32.dll"Alias"RasHangUpA"(ByValhRasConnAsLong)AsLong

  PrivateDeclareFunctionRasEnumConnectionsLib"RasApi32.dll"Alias"RasEnumConnectionsA"(lprasconnAsAny,lpcbAsLong,lpcConnectionsAsLong)AsLong

  ConstRAS95_MaxEntryName=256

  ConstRAS95_MaxDeviceName=128

  ConstRAS_MaxDeviceType=16

  PrivateTypeRASCONN95

  dwSizeAsLong

  hRasConnAsLong

  szEntryName(RAS95_MaxEntryName)AsByte

  szDeviceType(RAS_MaxDeviceType)AsByte

  szDeviceName(RAS95_MaxDeviceName)AsByte

  EndType

  下面一段代码是对Timer的控制,以及到设定时间的时候断开连接的代码

  PrivateSubTimer1_Timer()

  Timer1.Enabled=False

  If(Format100100time,"hh")&&":"&&Format100100time,"nn")&&":"&&Format100100time,"ss"))〈〉"00:00:00"Then

  time=DateAdd("s",-1,time)

  Label1.Visible=False

  Label1.Caption=Format100100time,"hh")&&":"&&Format100100time,"nn")&&":"&&Format100100time,"ss")

  Label1.Visible=True

  Timer1.Enabled=True

  Else

  Timer1.Enabled=False

  EndIf

  IfLabel1.Caption="00:00:01"Then

  dsdklj.WindowState=0

  Command1.Enabled=True

  MsgBox"时间到了,正在断开连接"

  DimlngRetCodeAsLong

  DimlpcbAsLong

  DimlpcConnectionsAsLong

  DimintArraySizeAsInteger

  DimintLooperAsInteger

  ReDimlprasconn95(intArraySize)AsRASCONN95

  lprasconn95(0).dwSize=412

  lpcb=256*lprasconn95(0).dwSize

  lngRetCode=RasEnumConnections(lprasconn95(0),lpcb,lpcConnections)

  IflngRetCode=0Then

  IflpcConnections〉0Then

  ForintLooper=0TolpcConnections-1

  RasHangUplprasconn95(intLooper).hRasConn

  NextintLooper

  UnloadMe

  Else

  MsgBox"时间到了,没有拨号网络连接"

  UnloadMe

  EndIf

  EndIf

  EndIf

  EndSub

  其实,这个程序还可以进一步的完善,比如添加暂停功能、或者经过改造,适用于宽带的,等等
'-----------------------
'Scan ASP WebShell in vbs
'Author: lake2 ()
'Date: 2007-7-29
'Version: 1.1
'-----------------------

DimFileExt="asp,cer,asa,cdx"
Dim Report, Report2, Sun, SumFiles, SumFolders

Call ShowInfo()
If WScript.Arguments.Count=2 Then
Sun=0
SumFiles=0
SumFolders=1
If Right(WScript.Arguments.Item(0),1)="" Then
thePath=Mid(WScript.Arguments.Item(0),1,Len(WScript.Arguments.Item(0))-1)
Else
thePath=WScript.Arguments.Item(0)
End If
Call CheckArg(thePath)
WScript.Echo "开始扫描,请稍候……"
WScript.Sleep(1000)
StartTime=now()
Call ShowAllFile(thePath)
EndTime=now()
WScript.Echo vbcrlf & "扫描完成。

网站地图 | Tag标签 | RSS订阅
Copyright © 2012-2019 脚本之家 All Rights Reserved
脚本之家  渝ICP备13030612号