SetStdHandleEx

Go to Home Page

Sets the handle for the specified standard device and returns the previous one

Syntax

BOOL WINAPI SetStdHandleEx (
    DWORD dwStdHandle,
    HANDLE hNewHandle,
    HANDLE* phOldHandle
)

Parameters

dwStdHandle
The standard handle to replace. Can be STD_INPUT_HANDLE, STD_OUTPUT_HANDLE or STD_ERROR_HANDLE
hNewHandle
The new handle
phOldHandle
A pointer to a handle that receives the previous value. Can be NULL in which case the function behaves exactly as SetStdHandle

Return Value

Non-zero if the function succeeds, zero otherwise. More information is available via GetLastError

Remarks

This function is equivalent to:

phOldHandle = GetStdHandle(dwStdHandle);
SetStdHandle(dwStdHandle, hNewHandle);