Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Quering waveform-audio output devices
Using GetSysColor
Writing entries to custom Event Log
Displaying the main Dial-Up Networking dialog box
Enumerating MIDI output devices
How to upload a local file to FTP server using FtpPutFile
Using GetNearestColor
Accessing Windows Control Panel from VFP Application
An alternative way of setting Form.Closable to False
GDI+: Color Transparency
Retrieving configuration information for the specified server (Win2000/XP)
Enumerating ODBC drivers available on the local computer
How to drag a Form not using its Titlebar or Caption
How to view system icons for the classes installed on the local machine
Reading VFP settings from the Windows Registry
Retrieving Window Class information for the VFP window
How to write and read Window Properties for the specified window
Obtaining Shell32.dll version
Reading data from INI files
System Image List Viewer
Using the GetLogicalDriveStrings
Yet another modal dialog: now HTML-based
How to download a file from HTTP server using URL Monikers functions
How to intercept window messages sent to VFP form
Saving available locale records into a cursor

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Versions:
click to open
Before you begin:
See also:
  • LanguageBar ActiveX control
  • Retrieving national language settings
  • Switching between keyboard layouts
  •  
    * some LOCALE constants
    #DEFINE LOCALE_ILANGUAGE                1   && language id
    #DEFINE LOCALE_SLANGUAGE                2   && localized name of language
    #DEFINE LOCALE_SENGLANGUAGE          4097   && English name of language
    #DEFINE LOCALE_SABBREVLANGNAME          3   && abbreviated language name
    #DEFINE LOCALE_SNATIVELANGNAME          4   && native name of language
    #DEFINE LOCALE_ICOUNTRY                 5   && country code
    #DEFINE LOCALE_SCOUNTRY                 6   && localized name of country
    #DEFINE LOCALE_SENGCOUNTRY           4098   && English name of country
    #DEFINE LOCALE_SABBREVCTRYNAME          7   && abbreviated country name
    #DEFINE LOCALE_SNATIVECTRYNAME          8   && native name of country
    #DEFINE LOCALE_IDEFAULTLANGUAGE         9   && default language id
    #DEFINE LOCALE_IDEFAULTCOUNTRY         10   && default country code
    #DEFINE LOCALE_IDEFAULTCODEPAGE        11   && default oem code page
    #DEFINE LOCALE_IDEFAULTANSICODEPAGE  4100   && default ansi code page
    #DEFINE LOCALE_IDEFAULTMACCODEPAGE   4113   && default mac code page
     
    #DEFINE LOCALE_ILDATE                  34   && long date format ordering
    #DEFINE LOCALE_ILZERO                  18   && leading zeros for decimal
    #DEFINE LOCALE_IMEASURE                13   && 0 = metric, 1 = US
    #DEFINE LOCALE_IMONLZERO               39   && leading zeros in month field
    #DEFINE LOCALE_INEGCURR                28   && negative currency mode
    #DEFINE LOCALE_INEGSEPBYSPACE          87   && mon sym sep by space from neg amt
    #DEFINE LOCALE_INEGSIGNPOSN            83   && negative sign position
     
    #DEFINE LOCALE_SDAYNAME1   0x0000002A
    #DEFINE LOCALE_SMONTHNAME1  0x00000038
    * there are at least 216 LOCALE constants
     
    DECLARE INTEGER GetLocaleInfo IN kernel32;
        INTEGER Locale, INTEGER LCType,;
        STRING @lpLCData, INTEGER cchData
     
    CREATE CURSOR cs (;
        locale    N(6),;
        langid    C( 4),;
        llnagname C(30),;
        elangname C(30),;
        alangname C( 3),;
        nlangname C(30),;
        ccode     C( 3),;
        lcname    C(30),;
        ecname    C(30),;
        acname    C( 3),;
        ncname    C(30),;
        dlangid   C( 4),;
        dccode    C( 3),;
        doemcp    C( 5),;
        dansicp   C( 5),;
        dmaccp    C( 5),;
        ldtfmt    C( 2),;
        ldzeros   C( 2),;
        metrics   C( 2),;
        monzero   C( 2),;
        necurr    C( 2),;
        negsep    C( 2),;
        negsign   C( 2),;
        sdayname1 C(10),;
        smonname1 C(20);
    )
     
    * scan top 0x10000 codes
    * under WinNT 4.0 it returns 138 records
    * WinMe -- 164 records
    FOR ii=0 TO 65535
        = SaveLInfo(ii)
    ENDFOR
     
    SELECT cs
    GO TOP
    BROWSE NORMAL NOWAIT
    * end of main
     
    PROCEDURE SaveLInfo(lnLocale)
    * saves one local record for the locale
        IF Len(GetLInfo(lnLocale, LOCALE_ILANGUAGE)) = 0
        * exit if no information exists for this locale id
            RETURN
        ENDIF
     
        INSERT INTO cs VALUES (;
            lnLocale,;
            GetLInfo(lnLocale, LOCALE_ILANGUAGE),;
            GetLInfo(lnLocale, LOCALE_SLANGUAGE),;
            GetLInfo(lnLocale, LOCALE_SENGLANGUAGE),;
            GetLInfo(lnLocale, LOCALE_SABBREVLANGNAME),;
            GetLInfo(lnLocale, LOCALE_SNATIVELANGNAME),;
            GetLInfo(lnLocale, LOCALE_ICOUNTRY),;
            GetLInfo(lnLocale, LOCALE_SCOUNTRY),;
            GetLInfo(lnLocale, LOCALE_SENGCOUNTRY),;
            GetLInfo(lnLocale, LOCALE_SABBREVCTRYNAME),;
            GetLInfo(lnLocale, LOCALE_SNATIVECTRYNAME),;
            GetLInfo(lnLocale, LOCALE_IDEFAULTLANGUAGE),;
            GetLInfo(lnLocale, LOCALE_IDEFAULTCOUNTRY),;
            GetLInfo(lnLocale, LOCALE_IDEFAULTCODEPAGE),;
            GetLInfo(lnLocale, LOCALE_IDEFAULTANSICODEPAGE),;
            GetLInfo(lnLocale, LOCALE_IDEFAULTMACCODEPAGE),;
            GetLInfo(lnLocale, LOCALE_ILDATE),;
            GetLInfo(lnLocale, LOCALE_ILZERO),;
            GetLInfo(lnLocale, LOCALE_IMEASURE),;
            GetLInfo(lnLocale, LOCALE_IMONLZERO),;
            GetLInfo(lnLocale, LOCALE_INEGCURR),;
            GetLInfo(lnLocale, LOCALE_INEGSEPBYSPACE),;
            GetLInfo(lnLocale, LOCALE_INEGSIGNPOSN),;
            GetLInfo(lnLocale, LOCALE_SDAYNAME1),;
            GetLInfo(lnLocale, LOCALE_SMONTHNAME1);
        )
    RETURN
     
    PROCEDURE GetLInfo(nLocale, nType)
    * retrieves value for specified locale and type
        cBuffer = REPLICATE(CHR(0), 250)
        nLength = GetLocaleInfo(nLocale, nType, @cBuffer, LEN(cBuffer))
    RETURN IIF(nLength > 0, SUBSTR(cBuffer, 1, nLength), "")
     
     
     

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    4136 bytes  
    Created: 2001-07-31 12:00:00  
    Modified: 2011-02-22 03:04:55  
    Visits in 7 days: 60  
    Listed functions:
    GetLocaleInfo
    Printer friendly API declarations
    My comment:
    This code retrieves all locale records available on your system.

    At this point I do not know how to create a call-back procedure within VFP (if it is really possible), so the only replacing option is to scan a wide range of could-be locale values.
    Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian  
    FreeTranslation.com offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.


    Copyright © 2001-2013 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

    Privacy policy
    Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (23.22.76.170)
    12.16 hrs.Function: 'GdipGetPropertyCount'
    Function group: 'GDI+ Image'
     Example: 'Loading a string resource from an executable file'
    12.85 hrs.Example: 'Connecting a local device to a network resource'
    Google
    Advertise here!