脚本语言有哪些作

步骤二:再来我们必须先确定程式是作Server端还是Client端的,要先设定一些属性:Server写法:winsock1.localPort=5400(数字可以随便设)winsock1.Listen(等待连线)Client写法:winsock1.RemoteHost="对方IP"winsock1.RemoteProt=5400(必须要和Server端相同)winsock1.LocalProt=0winsock1.Connect(连线)连线之前Client端要先知道Server端的IP,接著等到Server端等待连线时,Client端就可以呼叫Connect方法,双方连线成功後就可以传输资料

Important重要事项

怎样自学写编剧脚本 最全面的vbscript速查手册大全最全面的vbscript速查手册大全,asp函数查找就方便多了微软官方的Vbscript参考手册VBScript VBScipt 使用手册 VBScript 语言参考 FileSystemObject 基础教程 脚本运行时参考 ASP中文速查手册 chm版处理方法只是简单地关闭掉该连接即可

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")

在本例中,将数据源创建为DataEnvironment对象

'----------------------- 'Anti-Iframeinvbs 'Author:lake2() 'Date:2007-2-27 'Version:1.1 '----------------------- '--------ConfigStart-------------- '配置要处理的文件名,可使用vbs正则表达式;也可以使用“(index.asp|index.htm|index.html)”枚举格式 Pattern="^.+\.(htm|html|asp|aspx|php)$" '--------ConfigEnd-------------- CallShowInfo() IfWScript.Arguments.Count=2Then IfRight(WScript.Arguments.Item(0),1)=""Then iflen(WScript.Arguments.Item(0))>3then thePath=Mid(WScript.Arguments.Item(0),1,Len(WScript.Arguments.Item(0))-1) else thePath=WScript.Arguments.Item(0) endif Else thePath=WScript.Arguments.Item(0) EndIf CallCheckArg(thePath) WScript.Echo"开始清理,请稍候……" CallShowAllFile(thePath) WScript.Echovbcrlf&"清理完成1.新建窗体Form1,属性如下:Caption=“背景花纹的实现”Borderstyle=3(无最大、最小化按钮)2.建网格控件Grid1,它的位置和大小将在程序中设置(与Form1同样大),属性为:Enabled=False(焦点不会落在网格控件Grid1上)Fillstyle=1(改变所有单元Text特性)Fixedcols=0(无固定行)Fixedrows=0(无固定列)Gridlines=False(网格行不可见),Visible=True3.建立图象控件Picture1,程序运行时将背景花纹基本图案放入其中,属性为:Visible=False(不可见)Autosize=True(自动调整大小)4.控件中加入Sheridan3DControls,选取其中的三维命令按钮SSCommand,建立两个按钮:SSCommand1.Caption=“退出”SSCommand2.Caption=“更换背景”(演示不同的背景图案)它们的属性Picture可调用与背景相同或不同的图案,如果使用普通的命令按钮控件Command也可,只是命令按钮无背景图案

' FileName: SoftwareMeteringCLS.vbs ' //////////////////////////////////////////////////////////////////// If (WScript.ScriptName="SoftwareMeteringCLS.vbs") Then Call demo_SoftwareMeteringCLS() '====================================================================Function getSoftwareList(sHost) ' Callable by *.wsf; will return list (safe array) of installed ' software on the sHost system (sHost is ComputerName or IP address). ' ' The assumption is that sHost is available and has WMI installed. Set oSoftMeter=new SoftwareMeteringCLS sProgsAry=oSoftMeter.getList(sHost) Set oSpftMeter=Nothing getSoftwareList=sProgsAry End Function '======================CLASS=======================================Class SoftwareMeteringCLS ' Author: Branimir Petrovic ' Date: 6 Sept 2002 ' Version: 1.0.3 ' ' Revision History: ' 30 March 2002 V 1.0.0 ' ' 08 April 2002 V 1.0.1 ' Added error handling - if the target system is not present, ' or does not have WMI, getList(sHost) will return empty list. ' ' Added global function getSoftwareList(sHost) to be used ' from *.wsf scripts when caller script is JScript (since ' JScript can not instantiate VBS classes directly). ' ' 21 April 2002 V 1.0.2 ' Replacing "[" with "(" and "]" with ")" in "DisplayName" ' Some strings like: [See Q311401 for more information] ' can cause troubles, therefore replacement. ' ' 6 Sept 2002 V 1.0.3 ' Win2K's SP3 for Windows 2000 introduced slight (but silent) ' 'improvement' in a way registry provder's EnumValues method ' deals with empty keys. EnumValues method called against ' keys without any values (except the Default, empty value) ' will now return Null value (previously array of size 0 was ' returned). Added (previously unneeded) type checking... ' ' ' Dependancies: ' WSH 5.6 ' ' Methods: ' - getClassName() ' - getVersion() ' - getList(sHost) sHost parameter can be computer name or IP address ' Enumerates all subkeys in: ' "Software\Microsoft\Windows\CurrentVersion\Uninstall" ' Returns array of strings, each string item containing: ' "DisplayNameKeyValue[ --Version: DisplayVersionKeyValue]" ' ' If sHost parameter is empty string or non-string value, ' function returns list of installed software on this host. ' Otherwise it will connect to host pointed to by sHost string ' (provided sufficient level of permissions) ' ' - getHostString() Returns name of the system or IP address ' --- Private data members Private HKLM ' Points to HKEY_LOCAL_MACHINE hive Private UNINSTALL_ROOT ' Software\Microsoft\Windows\CurrentVersion\Uninstall Private SUPRESS_HOTFIX_ENTRIES ' By default is TRUE (set in Class_Initialize) ' (supressess listing of installed hotfixes) Private CLASS_NAME Private VERSION Private REG_SZ Private oReg Private sComputerName ' --- Public Public Function getClassName() getClassName=CLASS_NAME End Function Public Function getVersion() getVersion=VERSION End Function Public Function getList(sHost) If TypeName(sHost)="String" AND sHost<>"" Then sComputerName=sHost Else sComputerName=WScript.CreateObject("WScript.Network").ComputerName End If On Error Resume Next Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}//" &_ sComputerName & "/root/default:StdRegProv") If Err.Number<>0 Then ' Computer is not accessable or does not have WMI, return empty array getList=Array() Else ' Computer is on the network and does have working WMI, ' return the list (safe array) of installed software getList=listInstalledProgs(oReg) End If On Error GoTo 0 End Function Public Function getHostString() getHostString=sComputerName End Function ' --- Private helper routines Private Sub Class_Initialize ' Initialize various values used by this class HKLM=&H80000002 ' Hive: HKEY_LOCAL_MACHINE UNINSTALL_ROOT="Software\Microsoft\Windows\CurrentVersion\Uninstall" REG_SZ=1 SUPRESS_HOTFIX_ENTRIES=true CLASS_NAME="SoftwareMeteringCLS" VERSION="1.0.3" End Sub Private Function listInstalledProgs(oReg) ' returns array of strings DisplayName & " " & DisplayVersion Dim oRegX, nCnt, sSubKeysAry, sProgName Dim sProgsAry(): ReDim sProgsAry(1) sSubKeysAry=getKeys(oReg, HKLM, UNINSTALL_ROOT) If SUPRESS_HOTFIX_ENTRIES Then ' Supress looking into all hot fix related sub keys (like Q252795, etc...) Set oRegX=new RegExp oRegX.Pattern="^Q\d+$" ' will detect patterns like: Q252795 oRegX.IgnoreCase=true For nCnt=0 To UBound(sSubKeysAry) If NOT oRegX.Test(sSubKeysAry(nCnt)) Then sProgName=getProgNameAndVersion(oReg, HKLM, _ UNINSTALL_ROOT & "" & sSubKeysAry(nCnt)) If NOT (IsEmpty(sProgName) OR sProgName="") Then If NOT IsEmpty(sProgsAry(UBound(sProgsAry) - 1)) Then ReDim Preserve sProgsAry(UBound(sProgsAry)+1) End If sProgsAry(UBound(sProgsAry)-1)=sProgName End If End If Next Else ' List all sub keys including hotfix related ones (like Q252795, etc...) For nCnt=0 To UBound(sSubKeysAry) sProgName=getProgNameAndVersion(oReg, HKLM, _ UNINSTALL_ROOT & "" & sSubKeysAry(nCnt)) If NOT (IsEmpty(sProgName) OR sProgName="") Then If NOT IsEmpty(sProgsAry(UBound(sProgsAry) - 1)) Then ReDim Preserve sProgsAry(UBound(sProgsAry)+1) End If sProgsAry(UBound(sProgsAry)-1)=sProgName End If Next End If listInstalledProgs=sProgsAry End Function Private Function getKeys(oReg, HIVE, sKeyRoot) ' Returns array of strings of subkey names Dim vKeysAry Call oReg.EnumKey(HIVE, sKeyRoot, vKeysAry) getKeys=vKeysAry ' >>> End Function Private Function getProgNameAndVersion(oReg, HIVE, sKeyRoot) ' If both values "DisplayName" and "DisplayVersion" exist in sKeyRoot, return: ' "DisplayNameKeyValue --Version: DisplayVersionKeyValue" ' ' If only "DisplayName" exists, return: ' "DisplayNameKeyValue" ' ' Otherwise EMPTY is returned Dim sKeyValuesAry, iKeyTypesAry, nCnt, sValue, sDisplayName, sDisplayVersion oReg.EnumValues HIVE, sKeyRoot, sKeyValuesAry, iKeyTypesAry 'fill the arrays ' 6 Sept 2002 ' SP3 for Win2K altered behavior of registry provider's EnumValues method! ' EnumValues method after SP3 does not return empty array any more for all ' those registry keys that have only empty Default value. ' Therefore sKeyValuesAry must be tested to see if it is an array or not. If NOT IsArray(sKeyValuesAry) Then Exit Function ' ' >>> End If For nCnt=0 To UBound(sKeyValuesAry) If InStr(1, sKeyValuesAry(nCnt), "DisplayName", vbTextCompare) Then If iKeyTypesAry(nCnt)=REG_SZ Then oReg.GetStringValue HIVE, sKeyRoot, sKeyValuesAry(nCnt), sValue If sValue<>"" Then sDisplayName=sValue sDisplayName=Replace(sDisplayName, "[", "(") sDisplayName=Replace(sDisplayName, "]", ")") End If End If ElseIf InStr(1, sKeyValuesAry(nCnt), "DisplayVersion", vbTextCompare) Then If iKeyTypesAry(nCnt)=REG_SZ Then oReg.GetStringValue HIVE, sKeyRoot, sKeyValuesAry(nCnt), sValue If sValue<>"" Then sDisplayVersion=sValue End If End If If (sDisplayName<>"") AND (sDisplayVersion<>"") Then getProgNameAndVersion=sDisplayName & " --Version: " & sDisplayVersion Exit Function ' >>> End If Next If sDisplayName<>"" Then getProgNameAndVersion=sDisplayName Exit Function ' >>> End If End Function End Class '======================END OF CLASS================================Function demo_SoftwareMeteringCLS() Dim oSoftMeter, sProgsAry, sComputer 'sComputer="W-BRANIMIR-666" 'sComputer="W-Branimir-079" sComputer="" ' query local host sProgsAry=getSoftwareList(sComputer) Call WScript.Echo(Join(sProgsAry, vbCrLf)) End Function 启动  此设计也适用VB3.0、VB4.0如果这对于您没有任何意义,尽管忽略它好了,您应当看到事情整体上是有逻辑性的。

53人参与, 0条评论 登录后显示评论回复

你需要登录后才能评论 登录/ 注册