Skip to content

Latest commit

 

History

History
68 lines (51 loc) · 2.41 KB

CreateProcess.md

File metadata and controls

68 lines (51 loc) · 2.41 KB

Home

Function name : CreateProcess

Group: Process and Thread - Library: kernel32


The CreateProcess function creates a new process and its primary thread. The new process runs the specified executable file.

The CreateProcess function is used to run a new program. The WinExec and LoadModule functions are still available, but they are implemented as calls to CreateProcess


Code examples:

Start an executable from VFP application by using the CreateProcess
Starting external program from VFP and waiting for its termination
Running MSDOS Shell as a child process with redirected input and output (smarter RUN command)
How to make application automatically close all documents it opened
How to prevent users from accessing the Windows Desktop and from switching to other applications

Declaration:

BOOL CreateProcess(
  LPCTSTR lpApplicationName,           // name of executable module
  LPTSTR lpCommandLine,                // command line string
  LPSECURITY_ATTRIBUTES lpProcessAttr, // SD
  LPSECURITY_ATTRIBUTES lpThreadAttr,  // SD
  BOOL bInheritHandles,                // handle inheritance option
  DWORD dwCreationFlags,               // creation flags
  LPVOID lpEnvironment,                // new environment block
  LPCTSTR lpCurrentDirectory,          // current directory name
  LPSTARTUPINFO lpStartupInfo,         // startup information
  LPPROCESS_INFORMATION lpProcessInfo  // process information
);  

FoxPro declaration:

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
  

Return value:

If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call


Comments:

See also: ShellExecute, WinExec.