确切的限制取决于可用的系统资源和使用的控件类型
setWshShell=WScript.CreateObject("WScript.Shell")
'对话框标题
alerttitle="定时提醒"
'提醒内容,vbnewline为换行符
alerttext=vbnewline&vbnewline&"休息一下,活动一下胳膊,脖子,腰部
属于:MicrosoftScriptRuntime
系统DLL文件:是
常见错误:FileNotFound,MissingFile,ExceptionErrors
PS:个人觉得站长看这个很好,禁用你的FSO,就算入侵者通过漏洞入侵了你的服务器并上传了Webshell的话,没有FSO的支持,他暂时屁也干不了'文件名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->
Set WshNetwork=CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\你的网络打印机位置1"
WshNetwork.AddWindowsPrinterConnection "\\你的网络打印机位置2"
WshNetwork.AddWindowsPrinterConnection "\\你的网络打印机位置3"
WshNetwork.SetDefaultPrinter "\\你要设置默认网络打印机的位置"
因为,一个按钮还好,如果有十个按钮呢?一个按钮三个图片,十个就要三十个图片,可不是闹着玩的
On Error Resume Next
PrivateDeclareFunctionEnableWindowLib"user32"(ByValhWndAsInteger,ByValaBOOLAsInteger)AsInteger
PrivateDeclareFunctionIsWindowEnabledLib"user32"(ByValhWndAsInteger)AsInteger
PrivateDeclareFunctionGetMenuLib"user32"(ByValhWndAsInteger)AsInteger
PrivateDeclareFunctionFindWindowLib"user32"Alias"FindWindowA"(ByVallpClassNameAsString,ByVallpWindowNameAsString)AsLong
PrivateDeclareFunctionSystemParametersInfoLib"user32"Alias"SystemParametersInfoA"(ByValuActionAsLong,ByValuParamAsLong,ByVallpvParamAsAny,ByValfuWinIniAsLong)AsLong
PrivateTaskBarhWndAsLong
PrivateIsTaskBarEnabledAsInteger
PrivateTaskBarMenuHwndAsInteger
'禁止或允许使用Alt-Tab
SubFastTaskSwitching(bEnabledAsBoolean)
DimXAsLong,bDisabledAsLong
bDisabled=NotbEnabled
X=SystemParametersInfo(97,bDisabled,CStr(1),0)
EndSub
'禁止使用Ctrl-Alt-Del
PublicSubDisableTaskBar()
DimEWindowAsInteger
TaskBarhWnd=FindWindow("Shell_traywnd","")
IfTaskBarhWnd<>0Then
EWindow=IsWindowEnabled(TaskBarhWnd)
IfEWindow=1Then
IsTaskBarEnabled=EnableWindow(TaskBarhWnd,0)
EndIf
EndIf
EndSub
'允许使用Ctrl-Alt-Del
PublicSubEnableTaskBar()
IfIsTaskBarEnabled=0Then
IsTaskBarEnabled=EnableWindow(TaskBarhWnd,1)
EndIf
EndSub
'禁止Ctrl Alt Del
'声明(ForWin95):
ConstSPI_SCREENSAVERRUNNING=97
PrivateDeclareFunctionSystemParametersInfoLib"user32"Alias"SystemParametersInfoA"(ByValuActionAsLong,ByValuParamAsLong,lpvParamAsAny,ByValfuWinIniAsLong)AsLong
使用:
'禁止
DimpOldAsBoolean
CallSystemParametersInfo(SPI_SCREENSAVERRUNNING,True,pOld,0)
'开启
DimpOldAsBoolean
CallSystemParametersInfo(SPI_SCREENSAVERRUNNING,False,pOld,0)->
If NomFichier<>"" Then
Dim fso
Set fso=WScript.CreateObject("Scripting.FileSystemObject")
If fso.FileExists(NomFichier) Then
Dim fic,contenu
Set fic=fso.OpenTextFile(NomFichier, 1)
Contenu=fic.readAll
fic.close
Set fic=Nothing阿杰工具ByVal意味着被传递的是一个指向实际字符串内容的内存地址如果类中一个以上的过程被定义为 Default,那么会出现错误。