ShellExecute (SHELL32 .DLL)
| Description | Performs an operation on a specified file. |
|---|---|
| C Declare | HINSTANCE ShellExecute(
HWND hwnd,
LPCTSTR lpOperation,
LPCTSTR lpFile,
LPCTSTR lpParameters,
LPCTSTR lpDirectory,
INT nShowCmd
);
|
| VFP Declare | DECLARE INTEGER ShellExecute IN shell32; INTEGER hwnd,; STRING lpOperation,; STRING lpFile,; STRING lpParameters,; STRING lpDirectory,; INTEGER nShowCmd |
| Parameter(s) | hwnd Handle to a parent window. This window receives any message boxes that an application produces, such as error reporting. lpVerb A string, referred to as a verb, that specifies the action to be performed: edit, explore, find, open, print lpFile Address of a null-terminated string that specifies the file or object on which to execute the specified verb. lpParameters If the lpFile parameter specifies an executable file, lpParameters is an address to a null-terminated string that specifies the parameters to be passed to the application. lpDirectory Address of a null-terminated string that specifies the default directory. nShowCmd Flags that specify how an application is to be displayed when it is opened. |
| Return value | Returns a value greater than 32 if successful, or an error value that is less than or equal to 32 otherwise. . The return value is cast as an HINSTANCE for backward compatibility with 16-bit Microsoft® Windows® applications. It is not a true HINSTANCE, however. |
| Comments | None |
| Example(s) | *** Source: http://www.news2news.com/vfp/
*** -------------------------------------
DECLARE INTEGER CreateProcess IN kernel32;
STRING lpApplicationName,;
STRING lpCommandLine,;
INTEGER @ lpProcessAttributes,;
INTEGER @ lpThreadAttributes,;
INTEGER bInheritHandles,;
INTEGER dwCreationFlags,;
INTEGER @ lpEnvironment,;
STRING lpCurrentDirectory,;
STRING lpStartupInfo,;
STRING @ lpProcessInformation
lpApplicationName = "c:\winnt\notepad.exe" && adjust the path
lpCommandLine = " c:\newfile.txt" && note the leading space
lpProcessAttributes = 0 && no attributes
lpThreadAttributes = 0 && no attributes
bInheritHandles = 1 && yes
dwCreationFlags = 0
lpEnvironment = 0
lpCurrentDirectory = SYS(2003)
lpStartupInfo = REPLI (Chr(0), 250) && just a buffer
lpProcessInformation = REPLI (" ", 250)
? CreateProcess (;
lpApplicationName,;
lpCommandLine,;
@lpProcessAttributes,;
@lpThreadAttributes,;
bInheritHandles,;
dwCreationFlags,;
@lpEnvironment,;
lpCurrentDirectory,;
lpStartupInfo,;
@lpProcessInformation)
? lpProcessInformation
|
According to the Microsoft all WinExec calls are translated directly into corresponding CreateProcess calls |