` Printed Icetips Article

Icetips Article



Par2: Get regional settings
2004-11-12 -- Steve Lewis
 
Look at the Windows API call: GetLocaleInfo.  Here is a simple example of its usage:

     !api calls related to localization
     MODULE('winapi')
       GetUserDefaultLCID(),SIGNED,PASCAL
       GetLocaleInfoA(SIGNED lcid,SIGNED type, *CSTRING ret,SIGNED
szret),SIGNED,PASCAL,RAW
      
GetCurrencyFormatA(WORD,ULONG,*CSTRING,*CurrencyInfo,*CSTRING,SIGNED),SIGNED,PASCAL,RAW
     END

GetLocaleCountry     PROCEDURE                             ! Declare Procedure

LOCALE_SCOUNTRY      EQUATE(6)         !localized name of country

Locale               SIGNED,AUTO
SLen                 SIGNED,AUTO
iRtn                 SIGNED,AUTO
lpRtn                CSTRING(101),AUTO

  CODE
  Locale = GetUserDefaultLCID()
  lpRtn = ''
  SLen = GetLocaleInfoA(Locale, LOCALE_SCOUNTRY, lpRtn, 0)
  iRtn = GetLocaleInfoA(Locale, LOCALE_SCOUNTRY, lpRtn, SLen)

  RETURN lpRtn



Printed November 21, 2024, 6:33 am
This article has been viewed/printed 35236 times.