Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Pocket PC: custom RAPI class for operating with files and folders on mobile device
Retrieving statistics for the TCP protocol running on the local computer
Using the heap of the calling process to allocate memory blocks
A class that encrypts and decrypts files using Cryptography API Functions
Adding and deleting User Accounts
Dragging files from Explorer window and dropping them on FoxPro control (requires VFP9)
Enumerating devices installed on the local machine
How to download a file from HTTP server using URL Monikers functions
Retrieving list of files on the FTP directory
Switching between keyboard layouts
Validating URLs using moniker functions
How to block the ALT+TAB shortcut (WinXP)
How to retrieve adapter information for the local computer (including MAC address)
Testing serial ports
Class library providing access to the System Registry
Comparing dimensions of the VFP main window with _SCREEN properties
How to view icons stored in executable files (Icon Viewer) - II
Locking and unlocking file of a VFP table
Storing screen shot of a form to enhanced metafile (*.emf)
Using the DeleteFile
Converting a hexadecimal string to an integer
Displaying animated images on FoxPro form with BitBlt and StretchBlt functions
Enumerating print jobs and retrieving information for default printer (JOB_INFO_1 structures)
How to initiate System shutdown
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 (107.20.7.65)
    6 sec.Example: 'Determining whether or not the system is connected to the Internet'
    1.04 hrs.Function: 'RtlGetCompressionWorkSpaceSize'
    3.01 hrs.Function: 'HeapWalk'
    Function group: 'Memory Management'
     Function: 'GetClassLong'
    3.33 hrs.Example: 'WAV file recorder'
     Example: 'Comparing dimensions of the VFP main window with _SCREEN properties'
     Example: 'Retrieving configuration information for the specified server (Win2000/XP)'
    3.44 hrs.Function: 'GlobalFree'
     Function: 'MessageBeep'
    Function group: 'Error Handling'
    3.88 hrs.Example: 'Retrieving Window Class information for the VFP window'
    Google
    Advertise here!