Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Reading and setting Environment variables
Retrieving a handle to DLL and address of an exported function in it
Retrieving file information for the VFP executable running
Class library providing access to the System Registry
Displaying all TCP connections for the local system
How to play a waveform sound (a WAV file in particular)
How to retrieve adapter information for the local computer (including MAC address)
How to retrieve configuration data for a specified printer stored in the registry (PrinterDriverData key)
Reading metrics for the currently selected font
Retrieving graphic capabilities of your display
Disk in drive A:
How to assemble an array of strings and pass it to external function
Using the ChooseColor function
GDI+: how to make VFP controls visually shake and shudder
GDI+: Using Scale and Shear transformations
How to make the caption of a VFP application flashing in the Windows task bar
Opening the Page Setup dialog box to specify the attributes of a printed page
Retrieving information about the specified icon
The window and its ancestors
Converting long file names to the short format and vice versa
Deleting files into the Recycle Bin
Enumerating Performance Counters
How to drag a Form not using its Titlebar or Caption
Saving local machine ODBC Registry Entries to XML file
Reading and setting Environment variables

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
click to open
Before you begin:
See also:
  • One more way to retrieve environment strings
  • Creating INI file and adding strings to it
  • Storing environment strings in cursor
  • DECLARE INTEGER GetEnvironmentVariable IN kernel32;
        STRING lpName, STRING @lpBuffer, INTEGER nSize
    DECLARE INTEGER SetEnvironmentVariable IN kernel32;
        STRING lpName, STRING lpValue
    lcName = "DebugMode"
    ? _GetEnv (lcName)
    = _SetEnv (lcName, "True")
    ? _GetEnv (lcName)
    FUNCTION _GetEnv(lcName)
        LOCAL lcBuffer, lnResult
        lcBuffer = SPACE(1024)
        lnResult = GetEnvironmentVariable (lcName, @lcBuffer, Len(lcBuffer))
    RETURN  Iif(lnResult=0, "#nothing#", Left(lcBuffer, lnResult))
    FUNCTION _SetEnv(lcName, lcValue)
    RETURN SetEnvironmentVariable(lcName, lcValue) <> 0

    User rating: 10/10 (1 votes)
    Rate this code sample:
    • ~
    588 bytes  
    Created: 2001-09-18 12:00:00  
    Modified: 2011-12-10 09:20:22  
    Visits in 7 days: 113  
    Listed functions:
    Printer friendly API declarations
    My comment:
    A reminder: any changes you made to environment variables are effective only for current VFP session.

    Every process, when created, acquires its own separate environment block. And to my knowledge there is no way of information exchange between two VFP instances through environment variables.

    * * *
    After C# code executes:

    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: | 2006-10-16 04:53:09
    How to change the length of field name from standard length ( 10 character length)

    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 (
    7 sec.Solutions
    14 sec.Function: 'SQLAllocHandle'
    Function group: 'ODBC API'
    21 sec.Solutions
    28 sec.Example: 'Adding and deleting Scheduled Tasks using NetScheduleJob API functions'
    35 sec.Function: 'waveOutPrepareHeader'
    Function group: 'Windows Multimedia'
    42 sec.Function: 'InternetAutodialHangup'
    Function group: 'Internet Functions (WinInet)'
    48 sec.Example: 'Dragging files from Explorer window and dropping them on FoxPro control (requires VFP9)'
    1.02 min.Function: 'SQLAllocEnv'
    Function group: 'ODBC API'
    1.15 min.Function: 'FtpDeleteFile'
    1.28 min.Solutions
    Advertise here!