Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Creating a console window for Visual FoxPro application
How to display the Properties dialog box for a file (ShellExecuteEx)
Playing WAV files on InteractiveChange
Customizing the frame of top-level form: removing the standard frame (VFP9, Vista)
GDI+: Creating thumbnails to preview images in a directory
Using FoxTray ActiveX control: System Tray Icon and menu attached to VFP form
Winsock: resolving an address to a host name
GDI+: creating a gradient
How to print picture stored in enhanced-format metafile (*.emf)
Passing data records between VFP applications via the Clipboard
Shortcut Menu Class
Adding printer to the list of supported printers for the specified server
Creating the Open dialog box to specify the drive, directory, and name of a file to open
CryptoAPI: Collection of Providers class
How to print FoxPro form -- II
Terminating all running applications from a VFP program
How to copy the image of a form to the Clipboard using Bitmap API functions
How to display a user-defined icon in the MessageBox dialog
GDI+: copying to the Clipboard (a) image of active FoxPro window/form, (b) image file
How to prevent users from accessing the Windows Desktop and from switching to other applications
Verifying a file using the Authenticode policy provider
Drawing icons associated with the VFP main window
Enumerating ODBC Data Sources available on the local computer
Converting command-line string to a set of Unicode argument strings
Creating a console window for Visual FoxPro application

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
click to open
Before you begin:
The following code explains how to create and use console (DOS-like) window with Visual FoxPro application.

See also:
  • Running MSDOS Shell as a child process with redirected input and output (smarter RUN command)
  • Running external applications from VFP using WinExec
  • Using ShellExecute for performing operations on files
  • Running external applications from VFP using CreateProcess
  • Running an external program from FoxPro and waiting for its termination
      Members area. Log in to view this example.
      User name:
      Forgot your password?
      Sign up for
    the Membership

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    4578 bytes  
    Created: 2004-11-09 21:04:19  
    Modified: 2011-12-10 09:20:22  
    Visits in 7 days: 109  
    Listed functions:
    Printer friendly API declarations
    My comment:
    Unsolved issues:

  • the closing of opened console window automatically closes the whole FoxPro session; the SetWindowLong can not change attributes for the console window (error=5, access denied);

  • main FoxPro window stops redrawing itself after a console window is created.

    And of course, the main unsolved issue is finding a practicality in console windows.

    * * *
    I noticed that in VFP6 the code works a bit different -- methods ClearScreen and SetCursorPos. You may try to declare and call SetConsoleCursorPosition with just two parameters -- INTEGER and @STRING -- instead of INTEGER, SHORT, SHORT.
  • 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:
    Emerson Reed | 2013-06-07 10:22:05
    I'm receiving a "Declare DLL call caused an exception." error in the following line:
    = FillConsoleOutputCharacter(THIS.hStdout, 32,;
        nBufsize, 0,0,0)
    Please, could you take a look at it?
    I'm using VFP 9 and Windows 7 Professional (32 bits).
    AM | 2013-06-23 11:33:01
    Set a break point and check values of THIS.hStdout and nBufsize before calling FillConsoleOutputCharacter. Neither should be zero.

    Copyright 2001-2018 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.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (
    21 sec.Function: 'FindNextChangeNotification'
    Function group: 'File Management'
    38 sec.
    Function group: 'Hook'
    55 sec.
    Function group: 'GDI+ StringFormat'
    1.22 min.Function: 'SetThreadPriority'
    Function group: 'Process and Thread'
    1.5 min.
    Function group: 'Power Management'
    1.8 min.
    Function group: 'Painting and Drawing'
    2.07 min.Example: 'How to drag a Form not using its Titlebar or Caption'
    2.37 min.Function: 'FindExecutable'
    Function group: 'Shell Functions'
    2.63 min.Function: 'URLDownloadToCacheFile'
    Function group: 'URL Monikers'
    2.92 min.Function: 'SHFileOperation'
    Function group: 'Shell Functions'
    Advertise here!