Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to print FoxPro form
Enumerating print jobs and retrieving information for default printer (JOB_INFO_1 structures)
Printf-style formatted text output in VFP
Sending email messages with Simple MAPI
Displaying animated images on FoxPro form with BitBlt and StretchBlt functions
How to make a VFP form fading out when released (GDI version)
Sending a standard message with one or more attached files using default email client
How to retrieve the number of print jobs queued for the printer
Using WM_COPYDATA for interprocess communication (VFP9)
Converting characters in a URL into corresponding escape sequences and backwards
Downloading files from the FTP server using InternetReadFile
How to Start a Process as Another User (NT/XP/2K)
Printing Image File, programmatically set print page orientation to landscape
Copying picture of the active form to the Clipboard using Enhanced Metafile API functions
Creating a window using CreateWindowEx function
How to print a bitmap file
Winsock: retrieving Web pages using sockets (HTTP, port 80)
Enumerating ODBC Data Sources available on the local computer
Retrieving Network Provider information
Starting an external application in VFP using WinExec
Using the DrawText function
GDI+: Scrolling through large image using the mouse
How to ping a remote site using IP Helper API calls
Simple printer queue monitor: deletes, pauses, resumes print jobs for local printer
Writing to INI file

User rating: 10/10 (1 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:
  • Reading from INI file
  • Reading entries from Event logs
  • Writing entries to custom Event Log

  •  
    DO declare
     
    LOCAL lcFilename
    lcFilename = "c:\Temp\test.ini"
    = CreateFile(lcFilename)
     
    *** Technique 1
    * adding empty sections
    = WritePrivateProfileSection("General",   "", lcFilename)
    = WritePrivateProfileSection("Language",  "", lcFilename)
    = WritePrivateProfileSection("Devices",   "", lcFilename)
    = WritePrivateProfileSection("Uninstall", "", lcFilename)
    = WritePrivateProfileSection("Old Brown Shoe", "", lcFilename)
     
    *** Technique 2
    * adding key names and associated values to existing sections
     
    = WritePrivateProfileSection("General",;
        "startdir=C:\"     + Chr(0) +;
        "resolution=high"  + Chr(0) +;
        "delay=500"        + Chr(0) +;
        "security=default" + Chr(0),;
        lcFilename)
     
    = WritePrivateProfileSection("Language",;
        "Active=English" + Chr(0),;
        lcFilename)
     
    = WritePrivateProfileSection("Devices",;
        "Default=Fork"   + Chr(0) +;
        "Active=Spoon"   + Chr(0) +;
        "Emergency=Hand" + Chr(0),;
        lcFilename)
     
    *** Technique 3
    * adding new section and a key in one step
    = WritePrivateProfileSection("Environment",;
        "Active=Testing" + Chr(0),;
        lcFilename)
     
    *** Technique 4
    * adding new key to a section which exists
    = WritePrivateProfileString("General",;
        "datapath", "C:\App\Data", lcFilename)
     
    *** Technique 5
    * replacing existing key
    = WritePrivateProfileString("General",;
        "startdir", "C:\App", lcFilename)
     
    *** Technique 6
    * adding new key to the section, which does not exist
    = WritePrivateProfileString("Very Important Section",;
        "Urgent action", "Do not care", lcFilename)
     
    PROCEDURE CreateFile(lcFilename)
        IF FILE(lcFilename)
            DELETE FILE (lcFilename)
        ENDIF
     
        hFile = FCREATE(lcFilename)
        = FCLOSE(hFile)
     
    PROCEDURE declare
        DECLARE WritePrivateProfileSection IN kernel32;
            STRING lpAppName, STRING lpString,;
            STRING lpFileName
     
        DECLARE WritePrivateProfileString IN kernel32;
            STRING lpAppName, STRING lpKeyName,;
            STRING lpString, STRING lpFileName
     

    User rating: 10/10 (1 votes)
    Rate this code sample:
    • ~
    1945 bytes  
    Created: 2001-09-04 12:00:00  
    Modified: 2011-09-16 19:01:14  
    Visits in 7 days: 111  
    Listed functions:
    WritePrivateProfileSection
    WritePrivateProfileString
    Printer friendly API declarations
    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.186.38)
    4 sec.Function: 'RegDeleteValue'
    7 sec.Example: 'Peer-to-peer LAN messenger built with Mailslot API functions'
    6.71 hrs.Example: 'Monitoring changes occurring within a directory'
    Language: 'C#'
     Example: 'Verifying a file using the Authenticode policy provider'
    6.83 hrs.Example: 'Retrieving list of Global Atom names'
     Function: 'gethostbyaddr'
    Function group: 'Windows Sockets 2 (Winsock)'
     Function: 'OpenInputDesktop'
    9.59 hrs.Function: 'GdipRotateWorldTransform'
    Function group: 'GDI+ Graphics'
    11.11 hrs.Function: 'PathCompactPathEx'
    Function group: 'Shell Lightweight Utility APIs -- Path Functions'
    14.95 hrs.Function: 'GetNamedSecurityInfo'
    Function group: 'Security'
    Google
    Advertise here!