public void SetCursorShown(bool shown) { ConsoleCursorInfo cursorInfo = new ConsoleCursorInfo { Size = 1, Visible = shown }; Platform.SetConsoleCursorInfo(consoleHandle, ref cursorInfo); }
public void GetConsoleCursorInfo() { SafeConsoleHandle handle = CreateConsoleScreenBuffer(ConsoleAccess.GENERIC_READ); var cursorInfo = new ConsoleCursorInfo(); bool result = WinConsole.GetConsoleCursorInfo(handle, cursorInfo); Trace.WriteLine(TestHelpers.ObjectToString(cursorInfo)); Assert.That(result, Is.True); }
/// <summary> /// Retrieves information about the size and visibility of the cursor for the specified console screen buffer. /// </summary> /// <param name="hConsoleOutput"> /// [in] A handle to the console screen buffer. The handle must have the <c>GENERIC_READ</c> access right. /// </param> /// <returns> /// A pointer to a <see cref="ConsoleCursorInfo"/> structure that receives information about the console's /// cursor. /// </returns> public static ConsoleCursorInfo GetConsoleCursorInfo(SafeConsoleHandle hConsoleOutput) { var lpConsoleCursorInfo = new ConsoleCursorInfo(); WinError.ThrowLastWin32ErrorIfFailed( GetConsoleCursorInfo(hConsoleOutput, lpConsoleCursorInfo)); return lpConsoleCursorInfo; }
private void SetCursorInfo(bool visible, int size) { if (disposed) { throw new ObjectDisposedException(this.ToString()); } ConsoleCursorInfo cci = new ConsoleCursorInfo(visible, size); if (!WinCon.SetConsoleCursorInfo(_handle, cci)) { throw new ApplicationException("Error setting cursor information."); } }
private ConsoleCursorInfo GetCursorInfo() { if (disposed) { throw new ObjectDisposedException(this.ToString()); } ConsoleCursorInfo cci = new ConsoleCursorInfo(); if (!WinCon.GetConsoleCursorInfo(_handle, cci)) { throw new ApplicationException("Error getting cursor information."); } return cci; }
public static extern bool SetConsoleCursorInfo(IntPtr consoleHandle, ref ConsoleCursorInfo cursorInfo);