您现在的位置: > 首页 > 程序开发 > vb教程
>> 最新教程
>> 热门教程
>> 最新游戏资讯
>> 热门游戏资讯
VB 修改系统时间日期
作者:                来自:安迪教程网                 加入时间:10-10-14                进入论坛讨论

赞助商链接















VB 修改系统时间日期


        其实方法很多的 先来说个 最简单的 方法


  

shell "cmd /c date 2008-08-08",vbhide

 


   


 


       方法二


      


Dim d As Date
Private Sub Form_Load()
d = Date
Shell "cmd /c date 2008-08-08" '(替换成你需要的日期)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Shell "cmd /c date " & d, vbHide
End Sub

 


  其他版本的:


       

Private Declare Function SetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) As Long
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 CurDate As SYSTEMTIME

Private Sub Form_Load()
Dim lpSystemTime As SYSTEMTIME, succ As Long
With CurDate
.wYear = Year(Date)
.wMonth = Month(Date)
.wDay = Day(Date)
.wHour = Hour(Time)
.wMinute = Minute(Time)
.wSecond = Second(Time)
.wMilliseconds = 0
End With
With lpSystemTime
.wYear = 2008
.wMonth = 8
.wDay = 8
.wHour = Hour(Time)
.wMinute = Minute(Time)
.wSecond = Second(Time)
.wMilliseconds = 0
End With
succ = SetSystemTime(lpSystemTime)
If succ = 0 Then
MsgBox "修改时间失败!", vbCritical + vbOKOnly, "失败"
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim succ As Long
succ = SetSystemTime(CurDate)
If succ = 0 Then
MsgBox "修改时间失败!", vbCritical + vbOKOnly, "失败"
End If
End Sub




 


联系方式:QQ:6084884 email:agwcn@126.com 粤ICP备10101711号
本网站中发布的文章只代表发表人的个人观点,不代表安迪教程网网站的立场
copyright© 2000-2004 安迪教程网 All rights reserved agwcn.com