Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Winsock: retrieving information about available transport protocols
CryptoAPI: Collection of Providers class
Enumerating devices installed on the local machine
How to retrieve adapter information for the local computer (including MAC address)
How to run FoxPro application under different user name (impersonating user)
Locking mouse and keyboard input for the VFP application
Obtaining addresses for the adapters on the local computer (Win XP/2003/Vista)
Reading data from INI files
Retrieving IP statistics for the computer
Winsock: how to retrieve the protocol information corresponding to a protocol name
Winsock: resolving an address to a host name
GDI+: retrieving list of available image encoders and image decoders
How to create a desktop shortcut (shell link)
How to obtain Content-Type value for a file type from the System Registry
How to view icons stored in executable files (Icon Viewer)
Validating URLs using moniker functions
Finding out if the current user is the Guest account
How to display the port-configuration dialog box for a port on the specified server
How to play a waveform sound (a WAV file in particular)
PocketPC: custom RAPI class for executing routines on remote Windows CE device
Programmatically removing submenus from VFP main menu
Retrieving the name of the default printer for the current user on the local computer (Win NT/XP)
Storing screen shot of a form to enhanced metafile (*.emf)
Converting a hexadecimal string to an integer
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: 136  
    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 (67.202.9.192)
    3 sec.
    Function group: 'Brush'
    26.58 min.Function: 'ChangeClipboardChain'
    Function group: 'Clipboard'
    26.62 min.Function: 'GdiFlush'
    Function group: 'Painting and Drawing'
    3.92 hrs.Example: 'Using shared memory to exchange data between two FoxPro applications'
     Function: 'IsNetworkAlive'
    Function group: 'System Information'
     Function: 'SQLDisconnect'
    4.57 hrs.Example: 'Loading a string resource from an executable file'
    4.58 hrs.Function: 'CoTaskMemFree'
    5.36 hrs.Function: 'GetSystemWow64Directory'
    Function group: 'System Information'
    5.37 hrs.Function: 'EnumPrintProcessors'
    Google
    Advertise here!