Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to disable the Windows Clipboard (VFP9)
How to retrieve the number of print jobs queued for the printer
Reading list of folders and files on FTP server
Subclassing CommandButton control to create BackColor property
Disabling mouse and keyboard input for the main VFP window (with the app still running)
Pocket PC: custom RAPI class for operating with files and folders on mobile device
Creating an Open dialog box to specify the drive, directory, and name of a file to open (Shell32 version)
Displaying animated images on FoxPro form with BitBlt and StretchBlt functions
How to Start a Process as Another User (NT/XP/2K)
Using WM_COPYDATA for interprocess communication (VFP9)
How to draw custom Window Caption on FoxPro form
How to make a VFP form fading out when released (GDI version)
Quering a waveform-audio input device
Locking the workstation
Placing On-screen Alert on top of all windows
Retrieving Network Provider information
Retrieving size of a remote file
How to remove a directory that is not empty
Quering Audio Mixer Device
Transparent Menu Class (requires VFP9)
Converting image file to .ICO file
How to retrieve list of system DSNs (Data Source Name) with parameters
Retrieving country-specific dialing information from the Windows Telephony list of countries
Using Extended MessageBox() Class
Starting an external application in VFP using WinExec

User rating: 8.33/10 (3 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:
This code displays an ASCII file in maximized Notepad window. The file C:\newfile.txt is created if it does not exist.

Other code samples you might be interested in:
  • 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
  • How to Start a Process as Another User (NT/XP/2K)
  • Running MSDOS Shell as a child process with redirected input and output

  •  
    #DEFINE SW_HIDE 0
    #DEFINE SW_SHOWNORMAL 1
    #DEFINE SW_SHOWMINIMIZED 2
    #DEFINE SW_SHOWMAXIMIZED 3
    #DEFINE SW_SHOWNOACTIVATE 4
    #DEFINE SW_SHOW 5
    #DEFINE SW_MINIMIZE 6
    #DEFINE SW_SHOWMINNOACTIVE 7
    #DEFINE SW_SHOWNA 8
    #DEFINE SW_RESTORE 9
    #DEFINE SW_SHOWDEFAULT 10
     
    DECLARE INTEGER WinExec IN kernel32;
        STRING lpCmdLine, INTEGER nCmdShow
     
    LOCAL cCmdLine, nResult
     
    cCmdLine = ["notepad" "c:\newfile.txt"]
    *!*    cCmdLine = "C:\Program Files\Microsoft Office\Office10\WINWORD.EXE"
     
    nResult = WinExec(cCmdLine, SW_SHOWDEFAULT)
     
    IF nResult <= 31
        = MESSAGEBOX("WinExec failed with an error: " +;
            LTRIM(STR(nResult)) + "     ", 48)
    ENDIF
     

    User rating: 8.33/10 (3 votes)
    Rate this code sample:
    • ~
    652 bytes  
    Created: 2001-07-12 12:00:00  
    Modified: 2011-01-09 10:34:57  
    Visits in 7 days: 182  
    Listed functions:
    WinExec
    Printer friendly API declarations
    My comment:
    Running external applications through the WinExec call you bypass FOXRUN.PIF which makes the whole thing more efficient. According to the Microsoft: all WinExec calls are translated directly into corresponding CreateProcess calls.
    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.22.127.92)
    3.96 hrs.Example: 'Connecting a local device to a network resource'
     Example: 'Using Font and Text functions'
    3.97 hrs.Example: 'Setting properties of the window: caption and user-defined value'
    6.76 hrs.Example: 'How to ping a remote site using ICMP API calls'
     Example: 'Using File Mapping for enumerating files opened by Visual FoxPro'
    7.69 hrs.Function: 'GetFileTitle'
    Function group: 'Common Dialog Box'
    10.21 hrs.Function: 'HeapUnlock'
     Example: 'Storing screen shot of a form to enhanced metafile (*.emf)'
    12.54 hrs.Function: 'OpenPrinter'
    13.58 hrs.
    Google
    Advertise here!