Rubrik: Windows/System | 22.03.05 |
GetThreadLocale-Funktion Diese Funktion ermittelt die Sprach-ID des aufrufenden Threads. | ||
Betriebssystem: Win95, Win98, WinNT 3.1, Win2000, WinME | Views: 8.524 |
Deklaration:
Declare Function GetThreadLocale Lib "kernel32.dll" () As Long
Beschreibung:
Diese Funktion ermittelt die Sprach-ID des aufrufenden Threads.
Parameter:
keine |
Rückgabewert:
Die Funktion gibt die Sprach-ID des aktuellen Threads zurück.
Beispiel:
Private Declare Function GetTimeFormat Lib "kernel32.dll" _ Alias "GetTimeFormatA" ( _ ByVal Locale As Long, _ ByVal dwFlags As Long, _ lpTime As SYSTEMTIME, _ ByVal lpFormat As Any, _ ByVal lpTimeStr As String, _ ByVal cchTime As Long) As Long Private Declare Function GetThreadLocale Lib "kernel32.dll" () As Long Private Declare Function SetThreadLocale Lib "kernel32.dll" ( _ ByVal Locale As Long) As Long Private Declare Sub GetLocalTime Lib "kernel32.dll" (lpSystemTime As SYSTEMTIME) 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 ' GetDateFormat Locale-Konstanten Private Const LOCALE_SYSTEM_DEFAULT = &H400 ' Zeitformat des Systems Private Const LOCALE_USER_DEFAULT = &H800 ' Zeitformat des aktuellen Benutzers ' GetDateFormat dwFlags-Konstanten Private Const LOCALE_NOUSEROVERRIDE = &H80000000 ' Standard Systemformat des Datums wird ' genutzt und die Benutzereinstellungen ignoriert Private Const LOCALE_USE_CP_ACP = &H40000000 ' Der ANSI Zeichensatz soll für ' die Darstellung des Formats benutzt werden Private Const TIME_NOMINUTESORSECONDS = &H1 ' Keine Minuten oder Sekunden angeben Private Const TIME_NOSECONDS = &H2 ' Keine Sekunden angeben Private Const TIME_NOTIMEMARKER = &H4 ' AM/PM nicht anzeigen Private Const TIME_FORCE24HOURFORMAT = &H8 ' 24 Stunden-Zeit verwenden
' Formatiertes Datum ausgeben Private Sub Command1_Click() Dim ST As SYSTEMTIME, FTime As String * 256, Retval As Long ' Programm die Sprache des Systems zuweisen If GetThreadLocale << LOCALE_SYSTEM_DEFAULT Then Call SetThreadLocale(LOCALE_SYSTEM_DEFAULT) End If ' aktuelles Datum ermitteln Call GetLocalTime(ST) ' Datum formatieren Retval = GetTimeFormat(0&, 0&, ST, "HH':'mm':'ss' Uhr'", FTime, ' Len(FTime)) ' Datum ausgeben MsgBox Left$(FTime, Retval), , "Aktuelles Datum" End Sub