Skip to content

Latest commit

 

History

History
63 lines (45 loc) · 2.06 KB

OpenProcess.md

File metadata and controls

63 lines (45 loc) · 2.06 KB

Home

Function name : OpenProcess

Group: Process and Thread - Library: kernel32


The OpenProcess function opens an existing process object.


Code examples:

Enumerating Processes -- WinNT
Reading and setting the priority class values for the current process and thread
Terminating all running applications from a VFP program
How to find when the application started
Obtaining I/O counts for the current process
Obtaining names and positions for shortcuts located on the Windows Desktop
Moving shortcut to a specified position on the Windows Desktop

Declaration:

HANDLE OpenProcess(
  DWORD dwDesiredAccess,  // access flag
  BOOL bInheritHandle,    // handle inheritance option
  DWORD dwProcessId       // process identifier
);  

FoxPro declaration:

DECLARE INTEGER OpenProcess IN kernel32;
	INTEGER dwDesiredAccessas,;
	INTEGER bInheritHandle,;
	INTEGER dwProcId  

Parameters:

dwDesiredAccess [in] Specifies the access to the process object.

bInheritHandle [in] Specifies whether the returned handle can be inherited by a new process created by the current process.

dwProcessId [in] Specifies the identifier of the process to open.


Return value:

If the function succeeds, the return value is an open handle to the specified process. If the function fails, the return value is NULL.


Comments:

MSDN: the handle returned by the OpenProcess function can be used in any function that requires a handle to a process, such as the wait functions, provided the appropriate access rights were requested. When you are finished with the handle, be sure to close it using the CloseHandle function.