Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Saving available locale records into a cursor
Setting the mouse capture to the specified window
Downloading files from the FTP server using InternetReadFile
Drawing Windows predefined bitmaps using the LoadBitmap functions
Enumerating network resources
How to find when the application started
Obtaining a handle to the desktop associated with the calling thread
Retrieving graphic capabilities of default printer
Retrieving local computer and user names
Retrieving top-child window for the VFP form
Storing the environment strings in cursor
Reading header information from AVI file
Retrieving list of available disk drives
Scanning the hierarchy of child windows down from the main VFP window
How to check whether the system is 32-bit or 64-bit
How to view system icons for the classes installed on the local machine
Placing an arbitrary rectangular area of main VFP window on the Clipboard
Reading VFP settings from the Windows Registry
Transparent Menu Class (requires VFP9)
Winsock: reading and setting socket options
Drawing cursors for the classes defined by the system (preregistered): BUTTON, EDIT, LISTBOX etc.
How to delete all print jobs for a printer
How to set Creation Date/Time for a folder (WinNT)
Pocket PC: custom RAPI class for operating with the Object Store Databases
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: 110  
    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-2017 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.6.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (54.198.246.116)
    17 sec.Function: 'PathRenameExtension'
    Function group: 'Shell Lightweight Utility APIs -- Path Functions'
    30 sec.Function: 'GdipDisposeImage'
    Function group: 'GDI+ Image'
    44 sec.Function: 'UrlEscape'
    Function group: 'Shell Lightweight Utility APIs -- Path Functions'
    58 sec.Function: 'EnumDisplayDevices'
    Function group: 'Device Context'
    1.18 min.Solutions
    1.42 min.Function: 'CeGetStoreInformation'
    Function group: 'Remote Application Programming (RAPI)'
    1.62 min.Function: 'UrlMkGetSessionOption'
    Function group: 'URL Monikers'
    1.88 min.Function: 'AVIFileInfo'
    Function group: 'Windows Multimedia'
    2.13 min.Example: 'Printing text with the Escape function'
    2.38 min.Function: 'CopyFileTransacted'
    Function group: 'File Management'
    Google
    Advertise here!