Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
PocketPC: creating directories and files
Saving available locale records into a cursor
Using the Semaphore object
Using the high-resolution performance counter
Managing Cookies
Converting long file names to the short format and vice versa
GDI+: Storing DLL icon resources in image files
How to perform Base64 encoding/decoding using Cryptography API Functions
Accessing a CD device (cdaudio) with Multimedia Command Strings
Who owns the Windows Clipboard
How to intercept window messages sent to VFP form
Using GetCompressedFileSize (WinNT only)
Retrieving list of supported paper names (for example, Letter or Legal) for a given printer
GDI+: custom Slider control
Pocket PC: Folder Viewer
How to get the path to a Special Folder
Retrieving default spooling directory name
Terminating VFP application using the FatalAppExit
Retrieving current user for the process
Closing Windows
List of ODBC drivers installed (read from the [ODBC Drivers] section)
How to check whether the system is 32-bit or 64-bit
Changing system colors
Controlling master audio volume by sending WM_APPCOMMAND messages
Reading keys in the specified section of the Win.ini file

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
Before you begin:
Determine that Simple MAPI is available by checking the [MAIL] section in the computer"s WIN.INI file for the MAPI entry. This entry will have a value of 1 if Simple MAPI is installed, or 0 if uninstalled:

*lcSection = "Windows"  && section name
lcSection = "Mail"  && section name

lcKeys = getKeysString (lcSection)

CREATE CURSOR csWinIni (keyname C(30), keyvalue C(200))

lcKey = ""
FOR ii=1 TO Len(lcKeys)
    ch = SUBSTR (lcKeys, ii,1)
    IF ch = Chr(0)
        lcValue = GetKeyValue(lcSection, lcKey)
        INSERT INTO csWinIni VALUES (lcKey, lcValue)
        lcKey = ""
        lcKey = lcKey + ch


FUNCTION  getKeysString (lcSection)
* returns all key names found in this section
* delimited with zero character

    * Notice that lpKeyName declared as INTEGER 
    * to emulate an empty key name

    DECLARE INTEGER GetProfileString IN kernel32;
        STRING   lpAppName,;
        INTEGER  lpKeyName,;
        STRING   lpDefault,;
        STRING @ lpReturnedString,;
        INTEGER  nSize

    nSize = 1024
    lpReturnedString = Repli (Chr(0), nSize)

    lnResult = GetProfileString (lcSection, 0, "#empty#",;
        @lpReturnedString, nSize)
RETURN  Left(lpReturnedString, lnResult)

FUNCTION  GetKeyValue (lcSection, lcKey)

    * Notice that lpKeyName declared as STRING
    * because here we have a string value
    * supplied to this procedure

    DECLARE INTEGER GetProfileString IN kernel32;
        STRING   lpAppName,;
        STRING   lpKeyName,;
        STRING   lpDefault,;
        STRING @ lpReturnedString,;
        INTEGER  nSize

    nSize = 4096
    lpReturnedString = Repli (Chr(0), nSize)

    lnResult = GetProfileString (lcSection, lcKey, "#empty#",;
        @lpReturnedString, nSize)
RETURN  Left(lpReturnedString, lnResult)

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1546 bytes  
Created: 2001-09-04 12:00:00  
Modified: 2002-12-30 17:38:51  
Visits in 7 days: 238  
Listed functions:
Printer friendly API declarations
My comment:
A section in the Win.ini file must have the following form:

Word Index links for this example:
Translate this page:
  Spanish    Portuguese    German    French    Italian offers instant, free translations of text or web pages.
User Contributed Notes:
There are no notes on this subject.

Copyright 2001-2014 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.68), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (
2 sec.Function: 'HeapFree'
4 sec.Function: 'waveInStart'
Function group: 'Windows Multimedia'
5 sec.Example: 'Exporting DLL icon resources as .ICO files'
8 sec.Function: 'GetForegroundWindow'
Function group: 'Window'
10 sec.Function: 'FillRect'
12 sec.Function: 'CreateFont'
14 sec.
Function group: 'Device Context'
18 sec.Function: 'CryptCreateHash'
20 sec.Example: 'How to obtain Content-Type value for a file type from the System Registry'
25 sec.Example: 'Displaying the main Dial-Up Networking dialog box'
Advertise here!