Using Win32 functions in Visual FoxPro Image Gallery
Process and Thread
..msdn
AssignProcessToJobObject
CommandLineToArgvW
CreateJobObject
CreateProcess
CreateProcessAsUser
CreateProcessWithLogonW
ExitProcess
FreeEnvironmentStrings
GetCommandLine
GetCurrentProcess
GetCurrentProcessId
GetCurrentThread
GetCurrentThreadId
GetEnvironmentStrings
GetEnvironmentVariable
GetPriorityClass
GetProcessIoCounters
GetProcessTimes
GetProcessVersion
GetStartupInfo
GetThreadPriority
IsWow64Process
OpenProcess
RegisterServiceProcess
SetEnvironmentVariable
SetPriorityClass
SetThreadPriority
Sleep
TerminateJobObject
TerminateProcess
WinExec
Code examples:
Accessing Windows Control Panel from VFP Application
Confining Windows calculator inside the VFP main window
How to activate Windows Calculator
Setting properties of the window: caption and user-defined value
Starting an external application in VFP using WinExec
WinExec
..msdn    Add comment     W32 Constants      Translate this page
The WinExec function runs the specified application.

Note This function is provided only for compatibility with 16-bit Windows. Win32-based applications should use the CreateProcess function
Code examples:
How to activate Windows Calculator
Starting an external application in VFP using WinExec
Confining Windows calculator inside the VFP main window
Setting properties of the window: caption and user-defined value
Accessing Windows Control Panel from VFP Application
Declaration:
UINT WinExec(
  LPCSTR lpCmdLine,  // command line
  UINT uCmdShow      // window style
);
FoxPro declaration:
DECLARE INTEGER WinExec IN kernel32;
    STRING cCmdLine,;
    INTEGER nCmdShow

Parameters:
lpCmdLine
[in] Pointer to a null-terminated character string that contains the command line (file name plus optional parameters) for the application to be executed

uCmdShow
[in] Specifies how a Windows-based application window is to be shown ...
Return value:
If the function succeeds, the return value is greater than 31.

If the function fails, the return value is one of the following error values:

* The system is out of memory or resources.
* 0

* The .exe file is invalid (non-Win32 .exe or error in .exe image).
#DEFINE ERROR_BAD_FORMAT        11

* The specified file was not found.
#DEFINE ERROR_FILE_NOT_FOUND         2

* The specified path was not found.
#DEFINE ERROR_PATH_NOT_FOUND        3
Usage:
#DEFINE SW_NORMAL 1
= WinExec("notepad.exe", SW_NORMAL)
My comment:
The native VFP command RUN | ! Command probably uses the same way, though I feel that sometimes the direct calling is more effective.

Microsoft says:
If a malicious user were to create an application called "Program.exe" on a system, any program that incorrectly calls WinExec using the Program Files directory will run this application instead of the intended application.

Watch a short video to see how to use the WinExec in VFP.
Word Index links for the WinExec :
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2001-07-12 12:00:00
Modified: 2008-01-26 20:09:48
Visited in last 7 days: 61
User Contributed Notes:
There are no notes on this subject.


Copyright 2001-2014 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.68), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (23.22.128.96)
4 sec.Example: 'Terminating all running applications from a VFP program'
6 sec.Function: 'NetWkstaUserEnum'
Function group: 'Network Management'
9 sec.Example: 'GDI+: sending image of FoxPro form to printer'
11 sec.Example: 'GDI+: Scrolling through large image using the mouse'
16 sec.Function: 'NetUserGetGroups'
Function group: 'Network Management'
20 sec.Function: 'GetOpenFileName'
23 sec.Example: 'How to retrieve adapter information for the local computer (including MAC address)'
32 sec.Function: 'CloseHandle'
36 sec.Example: 'How to perform Base64 encoding/decoding using Cryptography API Functions'
42 sec.Example: 'Displaying the main Dial-Up Networking dialog box'
Google
Advertise here!