Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Custom GDI+ class
Splash Screen for the VFP application
Vertical Label control
Displaying dimmed window behind VFP top-level form
Subclassing CommandButton control to create BackColor property
Storing content of the Clipboard to a bitmap file
How to put a vertical text scrolling on the form (a movie cast)
How to make a VFP form fading out when released (GDI version)
How to put a horizontal text scrolling on the form (a news line, marquee)
Printing text with the Escape function
Storing screen shot of a form to bitmap file
Bitmap Class for Visual FoxPro application
Custom FTP Class for Visual FoxPro application
Playing WAV sounds simultaneously
How to play AVI file on the _screen
How to view icons stored in executable files (Icon Viewer) - II
Pocket PC: custom RAPI class for operating with files and folders on mobile device
CryptoAPI: Collection of Providers class
How to print FoxPro form -- II
Obtaining names and positions for shortcuts located on the Windows Desktop
Enumerating Processes -- WinNT
Copying picture of the active form to the Clipboard using Enhanced Metafile API functions
Passing data records between VFP applications via the Clipboard
Enumerating devices installed on the local machine
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: 148  
    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-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.147.40.153)
    16 sec.Function: 'waveOutPrepareHeader'
    Function group: 'Windows Multimedia'
    28 sec.Function: 'AVIStreamReadFormat'
    Function group: 'Windows Multimedia'
    43 sec.Function: 'CreateProcessWithLogonW'
    Function group: 'Process and Thread'
    57 sec.
    Function group: 'Cryptography Reference'
    1.2 min.Function: 'AVIStreamInfo'
    Function group: 'Windows Multimedia'
    1.45 min.Function: 'mmioCreateChunk'
    Function group: 'Windows Multimedia'
    1.68 min.Function: 'NetConnectionEnum'
    Function group: 'Network Management'
    1.92 min.Function: 'CeRapiGetError'
    Function group: 'Remote Application Programming (RAPI)'
    2.38 min.Login
    2.58 min.Examples
    Google
    Advertise here!