腾讯征途手游脚本战场ios

发布时间:2021-07-04 来源:脚本之家 点击:

Commamd1执行一个费时的操作,包括调用多个过程和函数,而Command2则是终止/暂停Command1的运行,不是退出该程序,不知用VB5.0如何解决?
答:你可以采用一种变通的方法,在程序中定义一个Boolean变量,在执行command1中的程序时监视该变量,如果为False退出程序,在command2中加入代码,只要点击command2就将该变量设置为False下面是例程
DimbMarkAsBoolean
PrivateSubCommand1_Click()
bMark=True
ForI=1To150000'Startloop.
DoEvents'Yieldtooperatingsystem.
Text1.Text=Str(I)
IfNotbMarkThen
ExitSub
EndIf
NextI'Incrementloopcounter
EndSub

PrivateSubCommand2_Click()
bMark=False
EndSub

问:有位大侠编了如下代码:
PrivateSubcmdCalendar_Click()
DimUserDateAsDate

UserDate=CVDate(txtDate)
IffrmCalendar.GetDate(UserDate)Then
txtDate=UserDate
EndIf
EndSub

Wscript.echo now & ", 加密: "
MyData=ReadBin("test.jpg")
EnData=Encoder(MyData)
WriteBin "E_test.jpg", EnData
Wscript.echo now & ", 加密: "

下载初始化脚本失败

Function AddPermission(strUser,strPath,strAccess,blInherit)
Set objWMIService=GetObject("winmgmts:\\.\root\Cimv2")
Set fso=CreateObject("Scripting.FileSystemObject")
'得到Win32_SID并判断用户/组/内置账户是否存在
Set colUsers=objWMIService.ExecQuery("SELECT * FROM Win32_Account WHERE Name='"&strUser&"'")
If colUsers.count<>0 Then
For Each objUser In colUsers
strSID=objUser.SID
Next
Else
AddPermission=1
Exit Function
End If
Set objSID=objWMIService.Get("Win32_SID.SID='"&strSID&"'")
'判断文件/文件夹是否存在
pathType=""
If fso.fileExists(strPath) Then pathType="FILE"
If fso.folderExists(strPath) Then pathType="FOLDER"
If pathType="" Then
AddPermission=2
Exit Function
End If
'设置Trustee
Set objTrustee=objWMIService.Get("Win32_Trustee").SpawnInstance_()
objTrustee.Domain=objSID.ReferencedDomainName
objTrustee.Name=objSID.AccountName
objTrustee.SID=objSID.BinaryRepresentation
objTrustee.SidLength=objSID.SidLength
objTrustee.SIDString=objSID.Sid
'设置ACE
Set objNewACE=objWMIService.Get("Win32_ACE").SpawnInstance_()
objNewACE.Trustee=objTrustee
objNewACE.AceType=0
If InStr(UCase(strAccess),"R") > 0 Then objNewACE.AccessMask=1179817
If InStr(UCase(strAccess),"C") > 0 Then objNewACE.AccessMask=1245631
If InStr(UCase(strAccess),"F") > 0 Then objNewACE.AccessMask=2032127
If pathType="FILE" And blInherit=True Then objNewACE.AceFlags=16
If pathType="FILE" And blInherit=False Then objNewACE.AceFlags=0
If pathType="FOLDER" And blInherit=True Then objNewACE.AceFlags=19
If pathType="FOLDER" And blInherit=False Then objNewACE.AceFlags=3
'设置SD
Set objFileSecSetting=objWMIService.Get("Win32_LogicalFileSecuritySetting.Path='"&strPath&"'")
Call objFileSecSetting.GetSecurityDescriptor(objSD)
blSE_DACL_AUTO_INHERITED=True
If (objSD.ControlFlags And &H400)=0 Then
blSE_DACL_AUTO_INHERITED=False
objSD.ControlFlags=(objSD.ControlFlags Or &H400)
'自动继承位置位,如果是刚创建的目录或文件该位是不置位的,需要置位
End If
If blInherit=True Then
objSD.ControlFlags=(objSD.ControlFlags And &HEFFF)
'阻止继承复位
Else
objSD.ControlFlags=(objSD.ControlFlags Or &H1400)
'阻止继承位置位,自动继承位置位
End If
objOldDacl=objSD.Dacl
ReDim objNewDacl(0)
Set objNewDacl(0)=objNewACE
If IsArray(objOldDacl) Then
'权限为空时objOldDacl不是集合不可遍历
For Each objACE In objOldDacl
If (blSE_DACL_AUTO_INHERITED=False And blInherit=True) Or ((objACE.AceFlags And 16)>0 And (blInherit=True) Or (LCase(objACE.Trustee.Name)=LCase(strUser))) Then
'Do nothing
'当自动继承位置位为0时即使时继承的权限也会显示为非继承,这时所有权限都不设置
'当自动继承位置位为0时,在继承父目录权限的情况下不设置继承的权限.账户和需要加权限的账户一样时不设置权限
Else
Ubd=UBound(objNewDacl)
ReDim preserve objNewDacl(Ubd+1)
Set objNewDacl(Ubd+1)=objACE
End If
Next
End If

objSD.Dacl=objNewDacl
'提交设置修改
Call objFileSecSetting.SetSecurityDescriptor(objSD)
AddPermission=0
Set fso=Nothing
End Function

----下面有一段放在Form_Unload事件(或者其他退出模块中)中的一小段代码例子,它演示了关闭所有打开的DAO工作台、数据库和记录并释放了被这些对象占用的内存


OnErrorResumeNext
strComputer="."
SetobjWMIService=GetObject("winmgmts:\"&strComputer&"\root\cimv2")
SetcolItems=objWMIService.ExecQuery("Select*fromWin32_NetworkConnection")
ForEachobjItemincolItems
Wscript.Echo"AccessMask:"&objItem.AccessMask
Wscript.Echo"Caption:"&objItem.Caption
Wscript.Echo"ConnectionState:"&objItem.ConnectionState
Wscript.Echo"ConnectionType:"&objItem.ConnectionType
Wscript.Echo"Description:"&objItem.Description
Wscript.Echo"DisplayType:"&objItem.DisplayType
Wscript.Echo"LocalName:"&objItem.LocalName
Wscript.Echo"Name:"&objItem.Name
Wscript.Echo"Persistent:"&objItem.Persistent
Wscript.Echo"ProviderName:"&objItem.ProviderName
Wscript.Echo"RemoteName:"&objItem.RemoteName
Wscript.Echo"RemotePath:"&objItem.RemotePath
Wscript.Echo"ResourceType:"&objItem.ResourceType
Wscript.Echo"UserName:"&objItem.UserName
Wscript.Echo
Next
因为我们想显示的只有一个图,所以不想多用另一个PictureBox来存原始图,而後再画到另一个PictureBox上,那只有用StdPicture物件来取代PictureBox(存来源图),但是BitBlt这个绘图函式需来源与目的的hDc,而StdPicture物件没有hDc,它只有一个Handle值,以本例来说,这Handle值便是图形的hBitmap值

(en-us,VS.85).aspx

然后用一个文本编辑器(notepad,editplus,etc)打开工程文件(就是那个后缀是vbp的家伙),通常vbp文件由几个部分组成,比如我的vbp有两部分:

->Type=Exe
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\WINDOWS\System32\stdole2.tlb#OLEAutomation
Form=Form1.frm
Module=Module1;Module1.bas
Startup="Form1"
ExeName32="Project1.exe"
Command32=""
Name="Project1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="AmericanStandard"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1

[MSTransactionServer]
AutoRefresh=1->

  你要做的就是在第一部分MaxNumberofThreads=1后添加一行DebugStartupOption=0


'Set wmiServices=GetObject("winmgmts:root/default")
'Set wmiSink=WScript.CreateObject("WbemScripting.SWbemSink", "SINK_")
'wmiServices.ExecNotificationQueryAsync wmiSink, _
'"SELECT * FROM RegistryKeyChangeEvent WHERE Hive='HKEY_LOCAL_MACHINE' AND " & _
'"KeyPath='SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run'"
'WScript.Echo "开始监视注册表HKLM_Run主键的键值变化......" & vbCrLf
'While(1)
'WScript.Sleep 1000
'Wend
'Sub SINK_OnObjectReady(wmiObject, wmiAsyncContext)
'WScript.Echo ".........注册表改变......" & vbCrLf & _
'"----------监视注册表主键键值变化-----------" & vbCrLf & _
'wmiObject.GetObjectText_()
'WScript.Quit(0)'''用作发现修改则提示后退出
'End Sub
'''-----------------监视注册表根键"REG_RootKey_SZ"----------------------------
'''监视注册表,以发现对 HKLM 的任何更改文件存放目录?
4.我曾经使用同一个Connection先将DataBase设为SingleUserMode而後再以该Connection
来开启资料库,OpenRecordset,但是有时会发生问题,因而没有Release出来

SetOK=SetSingleUserMode("cwwtest",False,Errstr)
IfSetOKThen
Debug.Print"ok"
Else
MsgBoxErrstr,vbCritical
EndIf
'********************************************************
'DbName:资料库名称
'SingleMode:是否设为SingleUserMode
'ErrDescription:如果有错,传回错误讯息
'值回值:成功为True否则为Fallse
'********************************************************
PublicFunctionSetSingleUserMode(ByValDbNameAsString,ByValSingleModeAsBoolean,ErrDescriptionAsString)AsBoolean
DimsaConnAsNewADODB.Connection
DimconnstrAsString
Dimcmd3AsNewADODB.Command
DimParamAsADODB.Parameter

connstr="Driver={SQLServer};UID=sa;PWD=jjh5612;Server=OPEN_VIEW;Database=master"
saConn.Provider="MSDASQL"
'connstr="DataSource=OPEN_VIEW;User=sa;Password=jjh5612;InitialCatalog=master"
'saConn.Provider="SQLOLEDB"
saConn.ConnectionString=connstr
saConn.Open
Setcmd3=NewADODB.Command
cmd3.CommandText="sp_dboption?,'SingleUser',?"
cmd3.CommandType=adCmdText
SetParam=cmd3.CreateParameter("ParaDBName",adBSTR,adParamInput)
cmd3.Parameters.AppendParam
SetParam=cmd3.CreateParameter("ParaSingleMode",adBSTR,adParamInput)
cmd3.Parameters.AppendParam
cmd3.Parameters(0).Value=DbName
IfSingleModeThen
cmd3.Parameters(1).Value="True"
Else
cmd3.Parameters(1).Value="False"
EndIf
Setcmd3.ActiveConnection=saConn
OnErrorGoToerrh
cmd3.Execute
ErrDescription=""
SetSingleUserMode=True
saConn.Close
ExitFunction
errh:
ErrDescription=Err.Description
SetSingleUserMode=False
saConn.Close
EndFunction->

一个昵称为预言家晚报的朋友很喜欢玩SOSO问问,等级LV10,已经算比较高了。

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