GetThreadLocale Function

Declare Function GetThreadLocale Lib "kernel32.dll" () As Long

Platforms

Description & Usage

GetThreadLocale identifies the locale of the thread which called the function (i.e., your program's thread). This locale determines the default preferences for display of various data for the program and may be different than that of other threads.

Return Value

The function returns the identifier of the calling thread's locale.

Visual Basic-Specific Issues

None.

Parameters

None.

Example

' This code is licensed according to the terms and conditions listed here.

' Use a case-senitive, string sort comparison method to alphabetically
' sort nine words.  The sorting method simply compares each possible
' pair of words; if a pair is out of alphabetical order, they are switched.
Dim words(1 To 9) As String  ' the words to sort
Dim tempstr As String  ' buffer used to swap strings
Dim oc As Integer, ic As Integer  ' counter variables
Dim compval As Long  ' result of comparison
Dim threadlocale As Long  ' locale ID of this thread

' Get the locale of this thread (i.e., of this program).
threadlocale = GetThreadLocale()

' Load the nine strings into the array.
words(1) = "can't"
words(2) = "cant"
words(3) = "cannot"
words(4) = "pants"
words(5) = "co-op"
words(6) = "coop"
words(7) = "Denver"
words(8) = "denver"
words(9) = "denveR"

' Sort the strings, swapping any pairs which are out of order.
For oc = 1 To 8  ' first string of the pair
  For ic = oc + 1 To 9  ' second string of the pair
    ' Compare the two strings.
    compval = CompareString(threadlocale, SORT_STRINGSORT, words(oc), Len(words(oc)), words(ic), Len(words(ic)))
    ' If words(oc) is greater, swap them.
    If compval = CSTR_GREATER_THAN Then
      tempstr = words(oc)
      words(oc) = words(ic)
      words(ic) = tempstr
    End If
  Next ic
Next oc

' Display the list of sorted words.
For oc = 1 To 9
  Debug.Print words(oc)
Next oc

See Also

SetThreadLocale

Category

National Language Support

Go back to the alphabetical Function listing.
Go back to the Reference section index.


Last Modified: January 4, 2000
This page is copyright © 2000 Paul Kuliniewicz. Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/g/getthreadlocale.html