This topic has not yet been rated - Rate this topic

GetConsoleProcessList function

Applies to: desktop apps only

Retrieves a list of the processes attached to the current console.

Syntax

DWORD WINAPI GetConsoleProcessList(
  __out  LPDWORD lpdwProcessList,
  __in   DWORD dwProcessCount
);

Parameters

lpdwProcessList [out]

A pointer to a buffer that receives an array of process identifiers upon success.

The storage for this buffer is allocated from a shared heap for the process that is 64 KB in size. The maximum size of the buffer will depend on heap usage.

dwProcessCount [in]

The maximum number of process identifiers that can be stored in the lpdwProcessList buffer.

Return value

If the function succeeds, the return value is less than or equal to dwProcessCount and represents the number of process identifiers stored in the lpdwProcessList buffer.

If the buffer is too small to hold all the valid process identifiers, the return value is the required number of array elements. The function will have stored no identifiers in the buffer. In this situation, use the return value to allocate a buffer that is large enough to store the entire list and call the function again.

If the return value is zero, the function has failed, because every console has at least one process associated with it. To get extended error information, call GetLastError.

Remarks

To compile an application that uses this function, define _WIN32_WINNT as 0x0501 or later. For more information, see Using the Windows Headers.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Header

Wincon.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

AttachConsole
Console Functions

 

 

Send comments about this topic to Microsoft

Build date: 2/3/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ