SetConsoleTextAttribute function Null safety kernel32

int SetConsoleTextAttribute(
  1. int hConsoleOutput,
  2. int wAttributes
)

Sets the attributes of characters written to the console screen buffer by the WriteFile or WriteConsole function, or echoed by the ReadFile or ReadConsole function. This function affects text written after the function call.

BOOL WINAPI SetConsoleTextAttribute(
  _In_ HANDLE hConsoleOutput,
  _In_ WORD   wAttributes
);

Implementation

int SetConsoleTextAttribute(int hConsoleOutput, int wAttributes) {
  final _SetConsoleTextAttribute = _kernel32.lookupFunction<
      Int32 Function(IntPtr hConsoleOutput, Uint16 wAttributes),
      int Function(
          int hConsoleOutput, int wAttributes)>('SetConsoleTextAttribute');
  return _SetConsoleTextAttribute(hConsoleOutput, wAttributes);
}