Ejemplo n.º 1
1
 public static extern bool SetConsoleMode(SafeConsoleHandle hConsoleHandle, ConsoleMode dwMode);
Ejemplo n.º 2
1
 public static extern bool GetConsoleMode(SafeConsoleHandle hConsoleHandle, out ConsoleMode lpMode);
Ejemplo n.º 3
0
 public static extern bool SetConsoleDisplayMode(
     SafeConsoleHandle hConsoleOutput,
     ConsoleDisplayMode dwFlags,
     out Coord lpNewScreenBufferDimensions);
Ejemplo n.º 4
0
 public static extern bool GetNumberOfConsoleInputEvents(
     SafeConsoleHandle hConsoleInput,
     out uint lpcNumberOfEvents);
Ejemplo n.º 5
0
        /// <summary>
        /// Retrieves extended information about the current console font.
        /// </summary>
        /// <param name="hConsoleOutput">
        /// [in] A handle to the console screen buffer. The handle must have the GENERIC_READ access right.
        /// </param>
        /// <param name="bMaximumWindow">
        /// [in] If this parameter is <c>TRUE</c>, font information is retrieved for the maximum window size. If this
        /// parameter is <c>FALSE</c>, font information is retrieved for the current window size.
        /// </param>
        /// <returns>
        /// A <see cref="ConsoleFontInfoEx"/> structure that receives the requested font information.
        /// </returns>
        public static ConsoleFontInfoEx GetCurrentConsoleFontEx(SafeConsoleHandle hConsoleOutput, bool bMaximumWindow)
        {
            var lpConsoleCurrentFontEx = new ConsoleFontInfoEx();
            WinError.ThrowLastWin32ErrorIfFailed(
                GetCurrentConsoleFontEx(hConsoleOutput, bMaximumWindow, lpConsoleCurrentFontEx));

            return lpConsoleCurrentFontEx;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Retrieves extended information about the specified console screen buffer.
        /// </summary>
        /// <param name="hConsoleOutput">
        /// [in] A handle to the console screen buffer. The handle must have the <see cref="ConsoleAccess.GENERIC_READ"/>
        /// access right.
        /// </param>
        /// <returns>
        /// A <see cref="ConsoleScreenBufferInfoEx"/> structure that receives the requested console screen buffer
        /// information.
        /// </returns>
        public static ConsoleScreenBufferInfoEx GetConsoleScreenBufferInfoEx(SafeConsoleHandle hConsoleOutput)
        {
            var lpConsoleScreenBufferInfoEx = new ConsoleScreenBufferInfoEx();
            WinError.ThrowLastWin32ErrorIfFailed(
                GetConsoleScreenBufferInfoEx(hConsoleOutput, lpConsoleScreenBufferInfoEx));

            return lpConsoleScreenBufferInfoEx;
        }
Ejemplo n.º 7
0
 public static extern bool GetConsoleScreenBufferInfo(
     SafeConsoleHandle hConsoleOutput,
     [Out] ConsoleScreenBufferInfo lpConsoleScreenBufferInfo);
Ejemplo n.º 8
0
        /// <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;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Writes a character string to a console screen buffer beginning at the current cursor location.
        /// </summary>
        /// <param name="hConsoleOutput">
        /// [in] A handle to the console screen buffer. The handle must have the <see cref="ConsoleAccess.GENERIC_WRITE"/>
        /// access right.
        /// </param>
        /// <param name="lpBuffer">
        /// [in] A pointer to a buffer that contains characters to be written to the console screen buffer.
        /// </param>
        /// <param name="nNumberOfCharsToWrite">
        /// [in] The number of characters to be written. If the total size of the specified number of characters
        /// exceeds the available heap, the function fails with <see cref="ERROR_NOT_ENOUGH_MEMORY"/>.
        /// </param>
        /// <returns>The number of characters actually written.</returns>
        public static uint WriteConsole(SafeConsoleHandle hConsoleOutput, string lpBuffer, uint nNumberOfCharsToWrite)
        {
            uint lpNumberOfCharsWritten;
            WinError.ThrowLastWin32ErrorIfFailed(
                WriteConsole(hConsoleOutput, lpBuffer, nNumberOfCharsToWrite, out lpNumberOfCharsWritten, IntPtr.Zero));

            return lpNumberOfCharsWritten;
        }
Ejemplo n.º 10
0
 public static extern bool WriteConsole(
     SafeConsoleHandle hConsoleOutput,
     string lpBuffer,
     uint nNumberOfCharsToWrite,
     out uint lpNumberOfCharsWritten,
     IntPtr lpReserved);
Ejemplo n.º 11
0
 public static extern bool SetConsoleWindowInfo(
     SafeConsoleHandle hConsoleOutput,
     [MarshalAs(UnmanagedType.Bool)] bool bAbsolute,
     [In] SmallRect lpConsoleWindow);
Ejemplo n.º 12
0
 public static extern bool SetConsoleTextAttribute(
     SafeConsoleHandle hConsoleOutput,
     CharacterAttributes wAttributes);
Ejemplo n.º 13
0
 public static extern bool SetConsoleScreenBufferSize(SafeConsoleHandle hConsoleOutput, Coord dwSize);
Ejemplo n.º 14
0
        /// <summary>
        /// Sets the display mode of the specified console screen buffer.
        /// </summary>
        /// <param name="hConsoleOutput">
        /// [in] A handle to the console screen buffer.
        /// </param>
        /// <param name="dwFlags">
        /// [in] The display mode of the console.
        /// </param>
        /// <returns>
        /// A <see cref="Coord"/> structure that receives the new dimensions of the screen buffer, in characters.
        /// </returns>
        public static Coord SetConsoleDisplayMode(SafeConsoleHandle hConsoleOutput, ConsoleDisplayMode dwFlags)
        {
            Coord lpNewScreenBufferDimensions;
            WinError.ThrowLastWin32ErrorIfFailed(
                SetConsoleDisplayMode(hConsoleOutput, dwFlags, out lpNewScreenBufferDimensions));

            return lpNewScreenBufferDimensions;
        }
Ejemplo n.º 15
0
 public static extern bool FlushConsoleInputBuffer(SafeConsoleHandle hConsoleInput);
Ejemplo n.º 16
0
 public static extern bool WriteConsoleInput(
     SafeConsoleHandle hConsoleInput,
     InputRecord[] lpBuffer,
     uint nLength,
     out uint lpNumberOfEventsWritten);
Ejemplo n.º 17
0
 public static extern bool GetConsoleCursorInfo(
     SafeConsoleHandle hConsoleOutput,
     [In, Out] ConsoleCursorInfo lpConsoleCursorInfo);
Ejemplo n.º 18
0
        /// <summary>
        /// Writes data directly to the console input buffer.
        /// </summary>
        /// <param name="hConsoleInput">
        /// [in] A handle to the console input buffer. The handle must have the <see cref="ConsoleAccess.GENERIC_WRITE"/>
        /// access right. 
        /// </param>
        /// <param name="lpBuffer">
        /// [in] A pointer to an array of <see cref="InputRecord"/> structures that contain data to be written to the
        /// input buffer.
        /// </param>
        /// <param name="nLength">
        /// [in] The number of input records to be written.
        /// </param>
        /// <returns>The number of input records actually written.</returns>
        public static uint WriteConsoleInput(SafeConsoleHandle hConsoleInput, InputRecord[] lpBuffer, uint nLength)
        {
            uint lpNumberOfEventsWritten;
            WinError.ThrowLastWin32ErrorIfFailed(
                WriteConsoleInput(hConsoleInput, lpBuffer, nLength, out lpNumberOfEventsWritten));

            return lpNumberOfEventsWritten;
        }
Ejemplo n.º 19
0
 public static extern Coord GetConsoleFontSize(SafeConsoleHandle hConsoleOutput, uint nFont);
Ejemplo n.º 20
0
 public static extern bool WriteConsoleOutput(
     SafeConsoleHandle hConsoleOutput,
     CharInfo[] lpBuffer,
     Coord dwBufferSize,
     Coord dwBufferCoord,
     [In, Out] SmallRect lpWriteRegion);
Ejemplo n.º 21
0
        /// <summary>
        /// Retrieves the current input mode of a console's input buffer or the current output mode of a console
        /// screen buffer.
        /// </summary>
        /// <param name="hConsoleHandle">
        /// [in] A handle to the console input buffer or the console screen buffer. The handle must have the 
        /// <c>GENERIC_READ</c> access right.
        /// </param>
        /// <returns>The current mode of the specified buffer.</returns>
        public static ConsoleMode GetConsoleMode(SafeConsoleHandle hConsoleHandle)
        {
            ConsoleMode lpMode;
            WinError.ThrowLastWin32ErrorIfFailed(GetConsoleMode(hConsoleHandle, out lpMode));

            return lpMode;
        }
Ejemplo n.º 22
0
 public static extern bool WriteConsoleOutputAttribute(
     SafeConsoleHandle hConsoleOutput,
     CharacterAttributes[] lpAttribute,
     uint nLength,
     Coord dwWriteCoord,
     out uint lpNumberOfAttrsWritten);
Ejemplo n.º 23
0
 public static extern bool GetConsoleScreenBufferInfoEx(
     SafeConsoleHandle hConsoleOutput,
     [In, Out] ConsoleScreenBufferInfoEx lpConsoleScreenBufferInfoEx);
Ejemplo n.º 24
0
        /// <summary>
        /// Copies a number of character attributes to consecutive cells of a console screen buffer, beginning at a
        /// specified location.
        /// </summary>
        /// <param name="hConsoleOutput">
        /// [in] A handle to the console screen buffer. The handle must have the <see cref="ConsoleAccess.GENERIC_WRITE"/>
        /// access right.
        /// </param>
        /// <param name="lpAttribute">
        /// [in] The attributes to be used when writing to the console screen buffer.
        /// </param>
        /// <param name="nLength">
        /// [in] The number of screen buffer character cells to which the attributes will be copied.
        /// </param>
        /// <param name="dwWriteCoord">
        /// [in] A <see cref="Coord"/> structure that specifies the character coordinates of the first cell in the
        /// console screen buffer to which the attributes will be written.
        /// </param>
        /// <returns>The number of attributes actually written to the console screen buffer.</returns>
        public static uint WriteConsoleOutputAttribute(
            SafeConsoleHandle hConsoleOutput,
            CharacterAttributes[] lpAttribute,
            uint nLength,
            Coord dwWriteCoord)
        {
            uint lpNumberOfAttrsWritten;
            WinError.ThrowLastWin32ErrorIfFailed(
                WriteConsoleOutputAttribute(hConsoleOutput, lpAttribute, nLength, dwWriteCoord, out lpNumberOfAttrsWritten));

            return lpNumberOfAttrsWritten;
        }
Ejemplo n.º 25
0
 public static extern bool GetCurrentConsoleFontEx(
     SafeConsoleHandle hConsoleOutput,
     [MarshalAs(UnmanagedType.Bool)] bool bMaximumWindow,
     [In, Out] ConsoleFontInfoEx lpConsoleCurrentFontEx);
Ejemplo n.º 26
0
 public static extern bool FillConsoleOutputCharacter(
     SafeConsoleHandle hConsoleOutput,
     char cCharacter,
     uint nLength,
     Coord dwWriteCoord,
     out uint lpNumberOfCharsWritten);
Ejemplo n.º 27
0
 public static extern Coord GetLargestConsoleWindowSize(SafeConsoleHandle hConsoleOutput);
Ejemplo n.º 28
0
        /// <summary>
        /// Writes a character to the console screen buffer a specified number of times, beginning at the specified
        /// coordinates.
        /// </summary>
        /// <param name="hConsoleOutput">
        /// [in] A handle to the console screen buffer. The handle must have the <see cref="ConsoleAccess.GENERIC_WRITE"/>
        /// access right.
        /// </param>
        /// <param name="cCharacter">
        /// [in] The character to be written to the console screen buffer.
        /// </param>
        /// <param name="nLength">
        /// [in] The number of character cells to which the character should be written.
        /// </param>
        /// <param name="dwWriteCoord">
        /// [in] A <see cref="Coord"/> structure that specifies the character coordinates of the first cell to which
        /// the character is to be written.
        /// </param>
        /// <returns>The number of characters actually written to the console screen buffer.</returns>
        public static uint FillConsoleOutputCharacter(
            SafeConsoleHandle hConsoleOutput,
            char cCharacter,
            uint nLength,
            Coord dwWriteCoord)
        {
            uint lpNumberOfCharsWritten;
            WinError.ThrowLastWin32ErrorIfFailed(
                FillConsoleOutputCharacter(hConsoleOutput, cCharacter, nLength, dwWriteCoord, out lpNumberOfCharsWritten));

            return lpNumberOfCharsWritten;
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Retrieves the number of unread input records in the console's input buffer.
        /// </summary>
        /// <param name="hConsoleInput">
        /// [in] A handle to the console input buffer. The handle must have the <c>GENERIC_READ</c> access right.
        /// </param>
        /// <returns>The number of unread input records in the console's input buffer.</returns>
        public static uint GetNumberOfConsoleInputEvents(SafeConsoleHandle hConsoleInput)
        {
            uint lpcNumberOfEvents;
            WinError.ThrowLastWin32ErrorIfFailed(GetNumberOfConsoleInputEvents(hConsoleInput, out lpcNumberOfEvents));

            return lpcNumberOfEvents;
        }
Ejemplo n.º 30
0
 public static extern bool SetConsoleActiveScreenBuffer(SafeConsoleHandle hConsoleOutput);