Noname > 30-08-10, 10:02 AM
Option Compare Database
Public Const LOCALE_SSHORTDATE = &H1F
Public Const WM_SETTINGCHANGE = &H1A
'same as the old WM_WININICHANGE
Public Const HWND_BROADCAST = &HFFFF&
Public Declare Function SetLocaleInfo Lib "kernel32" Alias _
"SetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As _
Long, ByVal lpLCData As String) As Boolean
Public Declare Function PostMessage Lib "user32" Alias _
"PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function GetSystemDefaultLCID 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
Sub SetSysDate()
Dim lLocal As Long
Dim Length As Long
Dim dwLCID As Long
Dim Buf As String * 1024
On Error GoTo SetSysDate_Error
lLocal = GetSystemDefaultLCID()
Length = GetLocaleInfo(lLocal, LOCALE_SSHORTDATE, Buf, Len(Buf))
If Not Left$(Buf, Length - 1) = "dd/MM/yyyy" Then
dwLCID = GetSystemDefaultLCID()
If SetLocaleInfo(dwLCID, LOCALE_SSHORTDATE, "dd/MM/yyyy") = False Then
MsgBox "Khong doi duoc dinh dang ngay he thong.", 64, "Thong bao"
Exit Sub
End If
PostMessage HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0
End If
Exit Sub
SetSysDate_Error:
MsgBox "Unexpected Error No. " & Err.Number & _
" in procedure SetSysDate of Form Main. " _
& vbCrLf & vbCrLf & Err.Description, 64, "Dish Care Centre"
End Sub
Private Sub Form_Load()
SetSysDate
End Sub
haquocquan > 05-10-10, 02:06 AM
hmhieu > 20-12-10, 04:56 PM
haquocquan > 12-05-11, 01:46 PM
haquocquan > 12-05-11, 04:23 PM
Cafe Via He > 12-05-11, 04:32 PM
haquocquan > 12-05-11, 04:49 PM
quanghoasla > 12-05-11, 07:49 PM
Cafe Via He > 13-05-11, 05:42 PM