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

📄 form1.frm

📁 variant code in this rar zipped package
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.Timer Timer1 
      Interval        =   500
      Left            =   3960
      Top             =   840
   End
   Begin VB.CommandButton Command2 
      Caption         =   "设定时间"
      Height          =   375
      Left            =   2040
      TabIndex        =   1
      Top             =   1320
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "预启动的程序"
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Top             =   1320
      Width           =   1575
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   3960
      Top             =   120
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Caption         =   "执行的程序的路径"
      Height          =   375
      Left            =   240
      TabIndex        =   2
      Top             =   120
      Width           =   3375
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim AlarmTime

Private Sub Command1_Click()
Call dialog '调用dialog子程序
End Sub

Private Sub Command2_Click()
AlarmTime = InputBox("请输入时间:<格式: 19:12:00>", "计划任务时间设定")
    If AlarmTime = "" Then
    Exit Sub
    If Not IsDate(AlarmTime) Then
    MsgBox "格式无效,请重试!", , "出错了"
    Else
    AlarmTime = CDate(AlarmTime)
    End If
    End If
    '判断输入的是否可转换成time格式
    'isdate函数是判断输入的是否可转换成date格式
End Sub
Private Sub Form_Click()
frmAbout.Show
End Sub

Private Sub Form_Load()
AlarmTime = "" '初始化时间
End Sub
Private Sub Form_Resize()
    If WindowState = 1 Then
    mintime
    Else
    Caption = "计划任务"
    End If
    '如果窗口被最小化,则调用mintime程序
End Sub
Private Sub mintime()
    Caption = Format(Time, "long Time")
    '使用长时间格式来显示时间
    End Sub
    Private Sub Timer1_Timer()
    If Time >= AlarmTime Then
    Call excute_sr
    End If '判断如果现在的时间超过了设定的时间,则调用excute_sr子程序
    If WindowState = 1 Then
    If Minute(CDate(Caption)) <> Minute(Time) Then
    mintime
    End If
    End If '最小化时显示时间每分钟的变化
    End Sub
    Sub dialog()
    CommonDialog1.Flags = cdlCFBoth
    CommonDialog1.ShowOpen
    Label1.Caption = CommonDialog1.FileName
    '把打开的文件名给于label1
    End Sub
    Sub excute_sr()
    Dim sr
    sr = Shell(Label1.Caption, 1)
    End
    '启动指定的文件,并且结束计划任务程序
    End Sub

⌨️ 快捷键说明

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