自己动手 丰衣足食...别指望别人帮你....
Public Const LOCALE_SSHORTDATE = &H1F ' short date format string
Public Const LOCALE_SDATE = &H1D ' date separator
Public Declare Function GetUserDefaultLCID Lib "kernel32" () As Long
Public Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long
Public Declare Function SetLocaleInfo Lib "kernel32" Alias "SetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String) As Long
Private Function SetLocalInfo() As Boolean
Dim llocal As Long
Dim sa As String
Dim lOk As Long
On Error GoTo ErrShow
sa = Space(20)
llocal = GetUserDefaultLCID()
lOk = GetLocaleInfo(llocal, LOCALE_SSHORTDATE, ByVal sa, 20)
If Trim(sa) <> "yyyy/MM/dd" Then
sa = "yyyy/MM/dd"
llocal = GetUserDefaultLCID()
SetLocaleInfo llocal, LOCALE_SSHORTDATE, ByVal sa
End If
sa = Space(2)
lOk = GetLocaleInfo(llocal, LOCALE_SDATE, ByVal sa, 2)
If Trim(sa) <> "/" Then
sa = "/"
lOk = SetLocaleInfo(llocal, LOCALE_SDATE, ByVal sa)
End If
SetLocalInfo = True
Exit Function
ErrShow:
MsgBox "系统日期不能自动设置为(2002/01/01)的格式" & vbCrLf & "请用手工先把系统日期改为如(2002/01/01)的格式,再运行本系统!"
End Function
[此贴子已经被作者于2006-12-7 16:38:14编辑过]