⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shutdown.frm

📁 定时关闭计算机的软件 VB源码.... 可选操作模式
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BackColor       =   &H00FFC0FF&
   Caption         =   "定时关机"
   ClientHeight    =   2835
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5055
   ForeColor       =   &H00FF8080&
   Icon            =   "shutdown.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   2835
   ScaleWidth      =   5055
   StartUpPosition =   3  '窗口缺省
   Begin VB.Timer Timer3 
      Interval        =   15000
      Left            =   4320
      Top             =   1080
   End
   Begin VB.Timer Timer2 
      Interval        =   1
      Left            =   3600
      Top             =   1080
   End
   Begin VB.CommandButton Command3 
      Caption         =   "关于"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2160
      TabIndex        =   10
      Top             =   1920
      Width           =   855
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "请选择定时方式"
      Height          =   1335
      Left            =   0
      TabIndex        =   7
      Top             =   0
      Width           =   2775
      Begin VB.OptionButton Option3 
         Caption         =   "立即关机"
         Height          =   255
         Left            =   240
         TabIndex        =   12
         Top             =   960
         Width           =   2055
      End
      Begin VB.OptionButton Option2 
         BackColor       =   &H00FFC0FF&
         Caption         =   "延时指定时长后关机"
         Height          =   255
         Left            =   240
         TabIndex        =   9
         Top             =   600
         Width           =   1935
      End
      Begin VB.OptionButton Option1 
         BackColor       =   &H00FFC0FF&
         Caption         =   "指定时间关机"
         Height          =   255
         Left            =   240
         TabIndex        =   8
         Top             =   240
         Width           =   1455
      End
   End
   Begin VB.Timer Timer1 
      Interval        =   1000
      Left            =   2880
      Top             =   1080
   End
   Begin VB.CommandButton Command2 
      BackColor       =   &H00FFC0FF&
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1080
      TabIndex        =   6
      Top             =   1920
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "确定"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   120
      TabIndex        =   5
      Top             =   1920
      Width           =   735
   End
   Begin VB.ComboBox Combo3 
      BackColor       =   &H00FFC0FF&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   330
      Left            =   2880
      TabIndex        =   4
      Top             =   1560
      Width           =   2055
   End
   Begin VB.ComboBox Combo2 
      BackColor       =   &H00FFC0FF&
      Height          =   300
      Left            =   1320
      TabIndex        =   2
      Top             =   1560
      Width           =   735
   End
   Begin VB.ComboBox Combo1 
      BackColor       =   &H00FFC0FF&
      Height          =   300
      Left            =   0
      TabIndex        =   0
      Top             =   1560
      Width           =   735
   End
   Begin VB.Label Label5 
      Caption         =   "给我写信"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3000
      MouseIcon       =   "shutdown.frx":0442
      MousePointer    =   99  'Custom
      TabIndex        =   14
      Top             =   2400
      Width           =   1215
   End
   Begin VB.Label Label4 
      Caption         =   "我的主页"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   720
      MouseIcon       =   "shutdown.frx":0594
      MousePointer    =   99  'Custom
      TabIndex        =   13
      Top             =   2400
      Width           =   1215
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "欢迎在使用过程中多提意见、建议和要求 -Smart"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   735
      Left            =   2880
      TabIndex        =   11
      Top             =   120
      Width           =   1935
   End
   Begin VB.Label Label3 
      BackColor       =   &H00FFC0FF&
      Caption         =   "分钟后"
      Height          =   255
      Left            =   2160
      TabIndex        =   3
      Top             =   1560
      Width           =   615
   End
   Begin VB.Label Label2 
      BackColor       =   &H00FFC0FF&
      Caption         =   "小时"
      Height          =   255
      Left            =   840
      TabIndex        =   1
      Top             =   1560
      Width           =   375
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const frmFreeSpace = 50
Dim i As Integer
Dim Sj As Long
Dim Xz As Integer

Private Sub Command1_Click()
Dim Xs As Integer
Dim Fz As Integer


If Option2 Then
Sj = 0
If Combo3.Text = "关闭计算机" Then
   Xz = 0
Else
   Xz = 1
End If
Timer1.Interval = 1000
Timer1.Enabled = True
Me.Hide
End If
If Option1 Then
   Me.Hide
   If Combo3.Text = "关闭计算机" Then
       Xz = 0
   Else
       Xz = 1
   End If
      
End If

If Option3 Then
   Dim MyRepl As Integer
   MyRepl = MsgBox("真的要立即关机吗?", vbYesNo + vbDefaultButton2 + vbQuestion, "询问")
   If MyRepl = 6 Then
   
   
   If Combo3.Text = "关闭计算机" Then
      ExitWindowsEx ewx_shutdown, 0
   Else
      ExitWindowsEx ewx_reboot, 0
   End If
   End If
End If

End Sub

Private Sub Command2_Click()
Dim Hd As Integer
Hd = MsgBox("真的要退出该程序吗?", 292, "退出确认")
If Hd = vbYes Then
   End
Else
   Me.Show
End If
End Sub

Private Sub Command3_Click()
MsgBox "版权归Smart所有,保留所有权利" + vbCr + vbLf + "E-mail: pcas400@163.com" + vbCr + vbLf + "Homepage: http://pcas400.fangwen.com/", vbOKOnly, "版权"
End Sub

Private Sub Form_Load()
If App.PrevInstance = True Then
   MsgBox "该程序已经运行,请勿重复运行!", 16, "重复运行"
   End
End If
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Frame1.Top = 0
Frame1.Left = 0

Combo1.Top = Frame1.Top + Frame1.Height + frmFreeSpace
Combo1.Left = 0
Label2.Top = Combo1.Top
Label2.Left = Combo1.Left + Combo1.Width + frmFreeSpace
Combo2.Top = Combo1.Top
Combo2.Left = Label2.Left + Label2.Width + frmFreeSpace
Label3.Top = Combo1.Top
Label3.Left = Combo2.Left + Combo2.Width + frmFreeSpace
Combo3.Top = Combo1.Top
Combo3.Left = Label3.Left + Label3.Width + frmFreeSpace
Option1 = False
Option2 = True
Option3 = False
Option1.BackColor = Form1.BackColor
Option2.BackColor = Form1.BackColor
Option3.BackColor = Form1.BackColor
Label4.BackColor = Form1.BackColor
Label5.BackColor = Form1.BackColor
Label4.Top = Command1.Top + Command1.Height + 50
Label5.Top = Label4.Top
Label4.Left = 400
Label4.Height = Command1.Height
Label5.Height = Label4.Height
Label4.Width = Form1.Width \ 5
Label5.Width = Label4.Width
Label5.Left = Form1.Width - 400 - Label5.Width


Me.Hide
For i = 0 To 239
   With Combo1
      .AddItem Str$(i)
   End With
Next i
For i = 0 To 59
   With Combo2
      .AddItem Str$(i)
   End With
Next i
With Combo3
   .AddItem "关闭计算机"
   .AddItem "重新启动计算机"
End With
'If Option1.Value = True Then
'   Combo1.Text = Hour(Now)
'   Combo2.Text = Minute(Now) + 5
'Else
   Combo1.Text = "0"
   Combo2.Text = "5"
'End If
   Combo3.Text = "关闭计算机"

Command1.Top = Combo1.Top + Combo1.Height + 2 * frmFreeSpace
Command1.Left = 5 * frmFreeSpace

Command3.Width = Command1.Width
Command3.Height = Command1.Height
Command3.Top = Command1.Top
Command3.Left = Form1.Width - 5 * frmFreeSpace - Command3.Width

Command2.Width = Command1.Width
Command2.Height = Command1.Height
Command2.Top = Command1.Top
Command2.Left = (Command3.Left - Command1.Left) \ 2 + 5 * frmFreeSpace
Me.Height = Frame1.Height + Combo1.Height + Command1.Height + 700 + Label4.Height

Timer1.Interval = 0

Form1.Show

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  With Label4
    .FontUnderline = False
    .BackColor = Form1.BackColor
    .ForeColor = RGB(0, 0, 0)
    .FontBold = False
    .FontItalic = False
  End With
  With Label5
    .FontUnderline = False
    .BackColor = Form1.BackColor
    .ForeColor = RGB(0, 0, 0)
    .FontBold = False
    .FontItalic = False
  End With

  
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Command2_Click
End Sub





Private Sub Label4_Click()
Dim ret&
ret& = ShellExecute(Me.hwnd, "Open", "http://pcas400.fangwen.com", "", App.Path, 1)
End Sub

Private Sub Label4_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  With Label4
    .BackColor = RGB(0, 0, 255)
    .ForeColor = RGB(255, 0, 0)
    .FontUnderline = True
    .FontBold = True
    .FontItalic = True
  End With
End Sub

Private Sub Label5_Click()
Dim ret&
ret& = ShellExecute(Me.hwnd, "Open", "mailto:pcas400@163.com", "", App.Path, 1)
End Sub

Private Sub Label5_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  With Label5
    .BackColor = RGB(0, 0, 255)
    .ForeColor = RGB(255, 0, 0)
    .FontUnderline = True
    .FontBold = True
    .FontItalic = True
  End With
  
End Sub

Private Sub Option1_Click()
  If Option1 = True Then
     If Minute(Now) < 55 Then
       Combo1.Text = Hour(Now)
       Combo2.Text = Minute(Now) + 5
     Else
       Combo1.Text = Hour(Now) + 1
       Combo2.Text = Minute(Now) - 55
     End If
  Else
     Combo1.Text = "0"
     Combo2.Text = "5"
  End If
End Sub

Private Sub Option2_Click()
   If Option2 = False Then
     If Minute(Now) < 55 Then
       Combo1.Text = Hour(Now)
       Combo2.Text = Minute(Now) + 5
     Else
       Combo1.Text = Hour(Now) + 1
       Combo2.Text = Minute(Now) - 55
     End If
  Else
     Combo1.Text = "0"
     Combo2.Text = "5"
  End If
End Sub


Private Sub Timer1_Timer()
If Option2 Then
Sj = Sj + 1
If Sj = Val(Combo1.Text) * 3600 + Val(Combo2.Text) * 60 Then
   Select Case Xz
         Case 0
              ExitWindowsEx ewx_shutdown, 0 '调用API函数实现关机
         Case 1
              ExitWindowsEx ewx_reboot, 0 '调用API函数实现重新启动
   End Select
End If
End If
End Sub

Private Sub Timer2_Timer()
If Option1 Then
  Label2.FontSize = 12
  Label2.Caption = ":"
  Label3.Visible = False
  Combo3.Left = Combo2.Left + Combo2.Width + frmFreeSpace
Else

Label2.FontSize = 9
Combo1.Top = Frame1.Top + Frame1.Height + frmFreeSpace
Combo1.Left = 0

Label2.Caption = "小时"
Label3.Caption = "分钟后"
Label3.Visible = True
Label2.Top = Combo1.Top
Label2.Left = Combo1.Left + Combo1.Width + frmFreeSpace
Combo2.Top = Combo1.Top
Combo2.Left = Label2.Left + Label2.Width + frmFreeSpace
Label3.Top = Combo1.Top
Label3.Left = Combo2.Left + Combo2.Width + frmFreeSpace
Combo3.Top = Combo1.Top
Combo3.Left = Label3.Left + Label3.Width + frmFreeSpace
End If

If Option3.Value = True Then
   Combo1.Visible = False
   Combo2.Visible = False
   Label2.Visible = False
   Label3.Visible = False
   
Else
   Combo1.Visible = True
   Combo2.Visible = True
   Label2.Visible = True
   Label3.Visible = True
   
End If

End Sub

Private Sub Timer3_Timer()
If Option1 Then
If Hour(Now) = Val(Combo1.Text) And Minute(Now) = Val(Combo2.Text) Then
   Select Case Xz
         Case 0
              ExitWindowsEx ewx_shutdown, 0 '调用API函数实现关机
         Case 1
              ExitWindowsEx ewx_reboot, 0 '调用API函数实现重新启动
   End Select
End If
End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -