﹒1.修改權限
執行 gpedit.msc
依序展開【電腦設定】【windows設定】【安全性設定】【本機原則】
打開【使用者權限指派】裡頭的【更改系統時間】
新增 everyone
﹒2.Win32 SetSystemTime API 函式
寫 vb程式
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 Form_Load()
Dim lReturn As Long
Dim lpSystemTime As SYSTEMTIME
lpSystemTime.wYear = 2012
lpSystemTime.wMonth = 1
lpSystemTime.wDayOfWeek = 3
lpSystemTime.wDay = 4
lpSystemTime.wHour = 2
lpSystemTime.wMinute = 0
lpSystemTime.wSecond = 0
lpSystemTime.wMilliseconds = 0
lReturn = SetSystemTime(lpSystemTime)
End Sub
執行
﹒3.改回實際時間
選【網際網路時間】標籤 (經過1.修改權限後才會出現)
點 【立即更新】
0 意見:
張貼留言