Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Custom GDI+ class
Capturing keyboard activity of another application with the Raw Input API (VFP9)
How to print a bitmap file
How to display Windows On-Screen Keyboard
Using the LoadImage function to have a bitmap file loaded and displayed on VFP main window
System Image List Viewer
Winsock: sending email messages (SMTP, port 25)
Creating the Save dialog box to specify the drive, directory, and name of a file to save
The window and its ancestors
Printing Image File, programmatically set print page orientation to landscape
Custom HttpRequest class (WinHTTP)
Using Video Capture: displaying on FoxPro form frames and previewing video obtained from a digital camera
How to convert a bitmap file to monochrome format (1 bpp)
Custom FTP Class for Visual FoxPro application
Mapping and disconnecting network drives
How to download a file from the FTP server using FtpGetFile
Using EnumPrinters function to enumerate locally installed printers
How to activate Windows Calculator
Displaying icons in the system tray (VFP9)
Drawing Windows predefined bitmaps using the LoadBitmap functions
Displaying the associated icons and descriptions for files and folders
Using FoxTray ActiveX control: System Tray Icon and menu attached to VFP form
Sending email messages with Simple MAPI
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: 54  
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-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 (107.21.156.140)
49.95 min.Function: 'StrCmpC'
Function group: 'String'
50.03 min.Example: 'Creating a window using CreateWindowEx function'
1.09 hrs.Function: 'DPtoLP'
Function group: 'Coordinate Space and Transformation'
 Example: 'How to put a vertical text scrolling on the form (a movie cast)'
 Example: 'GDI+: printing image file'
1.98 hrs.Function: 'DrawMenuBar'
Function group: 'Menu'
 Example: 'GDI+: Color Transparency'
 Example: 'How to display advanced Task Dialog (Vista)'
3 hrs.Example: 'How to print picture stored in enhanced-format metafile (*.emf)'
 Function: 'CryptEnumProviderTypes'
Google
Advertise here!