Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Extracting the name and extension parts of a path string
GDI+: loading image file, drawing on it, saving the result to another file
How to drag a Form not using its Titlebar or Caption
Retrieving the name and type of all available RAS-capable devices
How to release and renew a lease on an IP address previously obtained through Dynamic Host Configuration Protocol (DHCP)
How to retrieve the number of objects stored in the Recycle Bin
Retrieving configuration information for the specified server (Win98/Me)
Retrieving the state of your Internet connection
Using GetSysColor
Using the GetLogicalDriveStrings
Using the SetErrorMode for determining if a floppy drive is ready
Dial the Net Automatically
GetProcessVersion points at target OS
Pocket PC: creating new database in the Object Store and copying Contacts Database records into it
Power capabilities of the system: battery, UPS, sleep and hibernation modes, processor throttling
Using the CopyFile
Winsock: initializing the service in the VFP application
How to obtain the number of rows affected by remote UPDATE, INSERT or DELETE statement
Pocket PC: retrieving data from the Contacts Database
Retrieving default spooling directory name
Retrieving window and menu help context identifiers
Saying "Hello World!" with VFP and WinAPI
Retrieving configuration information for the specified server (Win2000/XP)
Accessing a CD device (cdaudio) with Multimedia Command Strings
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 = ""
    ELSE
        lcKey = lcKey + ch
    ENDIF
ENDFOR

SELECT csWinIni
GO TOP
BROW NORMAL NOWAIT

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: 23  
Listed functions:
GetProfileString
Printer friendly API declarations
My comment:
A section in the Win.ini file must have the following form:
[section]
key=string


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.35), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (184.73.66.157)
2 sec.Function: 'GetWindowLong'
Function group: 'Window Class'
3 sec.Function: 'CreateSolidBrush'
5 sec.Function: 'Escape'
Function group: 'Printing and Print Spooler'
6 sec.Example: 'Reading and setting explicit Application User Model ID for the current process (Win7)'
8 sec.Function: 'MAPISendDocuments'
Function group: 'Simple MAPI'
9 sec.Function: 'DeleteDC'
10 sec.Example: 'Creating a file, then moving it to another destination'
12 sec.Function: 'CryptStringToBinary'
13 sec.Example: 'Monitoring changes occurring within a directory'
15 sec.Function: 'GetMonitorContrast'
Google
Advertise here!