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

📄 form1.frm

📁 此源代码可以实现设置系统时间
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   495
      Left            =   960
      TabIndex        =   0
      Top             =   2160
      Width           =   2775
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' =======================
' HOWTO: Set the System Time
' Article ID: Q154009
' =======================

'REFERENCES
'The SYSTEMTIME Type structure is as follows:
'
'
'   WYear           Integer-The current year.
'   WMonth          Integer-The current month. January is 1.
'   WDayOfWeek      Integer-The current day of the week. Sunday is 0.
'   WDay            Integer-The current day of the month.
'   WHour           Integer-The current hour.
'   wMinute         Integer-The current minute.
'   wSecond         Integer-The current second.
'   wMilliseconds   Integer-The current millisecond.

Option Explicit

Private Type SYSTEMTIME
  wYear As Integer
  wMonth As Integer
  wDayOfWeek As Integer
  wDay As Integer
  wHour As Integer
  wMinute As Integer
  wSecond As Integer
  wMilliseconds As Integer
End Type

Private Declare Function SetSystemTime Lib "kernel32" (lpSystemTime _
  As SYSTEMTIME) As Long

Private Sub Command1_Click()
  Dim lReturn As Long
  Dim lpSystemTime As SYSTEMTIME
  lpSystemTime.wYear = 1996
  lpSystemTime.wMonth = 6
  lpSystemTime.wDayOfWeek = 5
  lpSystemTime.wDay = 28
  lpSystemTime.wHour = 9
  lpSystemTime.wMinute = 42
  lpSystemTime.wSecond = 0
  lpSystemTime.wMilliseconds = 0
  lReturn = SetSystemTime(lpSystemTime)
End Sub


⌨️ 快捷键说明

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