Datumstrennzeichen

Hallo,

Kann mir jemand zeigen wie ich mit VB6 das Datumstrennzeichen von WindowsXP Home Edition einstellen kann.

Es geht darum, daß ich ein Programm aus Italien habe das nur funktioniert wenn das Systemdatum im Format tt/mm/jj (normal tt.mm.jj) vorliegt.
Ich will mit VB das Zeichen „.“ gegen „/“ austauschen.

Gruß Frank

Das müsste auch unter WinXP über die API gehen:

Public Const LOCALE\_SSHORTDATE = &H1F
Public Const LOCALE\_SLONGDATE = &H20

Public Const WM\_SETTINGCHANGE = &H1A
Public Const HWND\_BROADCAST = &HFFFF&

Private 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
Private Declare Function SetLocaleInfo Lib "kernel32" Alias \_
 "SetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As \_
 Long, ByVal lpLCData As String) As Long
Private Declare Function SendMessage Lib "user32" Alias \_
 "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, \_
 ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetSystemDefaultLCID Lib "kernel32" \_
 () As Long

Dim Chan As Long
Public Function SetLocale(LCType As Long, cData As String)
Dim dwLCID As Long, Res As Long, Tmp As String, L As Long
 dwLCID = GetSystemDefaultLCID()
 Tmp = String(255, 0)
 L = Len(Tmp)
 If SetLocaleInfo(dwLCID, LCType, cData) = 0 Then
 MsgBox "Fehler in SetLocale: SetLocaleInfo"
 Else
 Res = SendMessage(HWND\_BROADCAST, WM\_SETTINGCHANGE, 0&, 0&amp:wink:
 End If
End Function

Public Function GetLocale(LCType As Long)
Dim dwLCID As Long, Res As Long, Tmp As String, L As Long
 dwLCID = GetSystemDefaultLCID()
 Tmp = String(255, 0)
 L = Len(Tmp)
 Res = GetLocaleInfo(dwLCID, LCType, Tmp, L)
 If Res 0 Then GetLocale = Mid(Tmp, 1, Res - 1)
End Function

' und dann:
SetLocale LOCALE\_SSHORTDATE,"dd/MM/yyyy"

Gruß aus dem Norden
Reinhard Kraasch (http://www.kraasch.de - Access / VB(A) Tipps & Tricks)

Funktioniert
Hallo Reinhard,

Vielen Dank, funktioniert einwandfrei unter XP und Win98SE

Gruß Frank