Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to release and renew a lease on an IP address previously obtained through Dynamic Host Configuration Protocol (DHCP)
Tracking mouse movement to detect when to start dragging
Compressing and decompressing files with Windows API Runtime Library routines
How to play MIDI notes
Retrieving information about the main VFP window
Retrieving the User Datagram Protocol (UDP) listener table
Switching between keyboard layouts
Changing pitch and speed of a wave file
Class library providing access to the System Registry
Customizing the frame of top-level form: removing the standard frame (VFP9, Vista)
How to block the ALT+TAB shortcut (WinXP)
Locking and unlocking file of a VFP table
Obtaining names of local and global groups for current user (WinNT/XP/2K)
Quering Audio Mixer Device
Testing if a connection to an Url can be established
Adding supplementary data to AVI files
Animating a transition of the VFP form (a wire-frame rectangle)
Displaying the main Dial-Up Networking dialog box
Drawing standard Windows icons
GDI+: how to make VFP controls visually shake and shudder
Storing screen shot of a form to bitmap file
Using the IsWindowEnabled function
Converting characters in a URL into corresponding escape sequences and backwards
Downloading files from the FTP server using InternetReadFile
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: 131  
    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 (23.20.196.179)
    4 sec.Example: 'Running MSDOS Shell as a child process with redirected input and output (smarter RUN command)'
    46.63 min.Function: 'NetGetDCName'
    Function group: 'Network Management'
    7.42 hrs.Example: 'Get the power status of your laptop computer'
     Function: 'LookupPrivilegeDisplayName'
    8.21 hrs.Function: 'AppendMenu'
    Function group: 'Menu'
    11.3 hrs.Example: 'GDI+: converting text strings to images and saving in a graphics file'
     Example: 'Placing a button on the VFP form as a new child window'
    17.49 hrs.Example: 'Class library providing access to the System Registry'
    20.38 hrs.Example: 'Using the DrawText function'
    20.96 hrs.Example: 'How to download a file from HTTP server using URL Monikers functions'
    Google
    Advertise here!