Kernel32GetStdHandle Method

Retrieves a handle to the specified standard device (standard input, standard output, or standard error).

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", SetLastError = true)]
public static IntPtr GetStdHandle(
	StandardDevice std
)

Parameters

std  StandardDevice
A handle to the standard device.

Return Value

IntPtr
If the function succeeds, the return value is a handle to the specified device, or a redirected handle set by a previous call to SetStdHandle.

The handle has GENERIC_READ and GENERIC_WRITE access rights, unless the application has used SetStdHandle to set a standard handle with lesser access.

If the function fails, the return value is INVALID_HANDLE_VALUE ( New IntPtr(-1) ).

To get extended error information, call GetLastWin32Error.

If an application does not have associated standard handles, such as a service running on an interactive desktop, and has not redirected them, the return value is Zero.

Remarks

See Also