コード例 #1
1
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool SetConsoleMode(SafeConsoleHandle hConsoleHandle, ConsoleMode dwMode);
コード例 #2
1
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool GetConsoleMode(SafeConsoleHandle hConsoleHandle, out ConsoleMode lpMode);
コード例 #3
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool SetConsoleDisplayMode(
     SafeConsoleHandle hConsoleOutput,
     ConsoleDisplayMode dwFlags,
     out Coord lpNewScreenBufferDimensions);
コード例 #4
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool GetNumberOfConsoleInputEvents(
     SafeConsoleHandle hConsoleInput,
     out uint lpcNumberOfEvents);
コード例 #5
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
        /// <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;
        }
コード例 #6
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
        /// <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;
        }
コード例 #7
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool GetConsoleScreenBufferInfo(
     SafeConsoleHandle hConsoleOutput,
     [Out] ConsoleScreenBufferInfo lpConsoleScreenBufferInfo);
コード例 #8
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
        /// <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;
        }
コード例 #9
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
        /// <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;
        }
コード例 #10
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool WriteConsole(
     SafeConsoleHandle hConsoleOutput,
     string lpBuffer,
     uint nNumberOfCharsToWrite,
     out uint lpNumberOfCharsWritten,
     IntPtr lpReserved);
コード例 #11
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool SetConsoleWindowInfo(
     SafeConsoleHandle hConsoleOutput,
     [MarshalAs(UnmanagedType.Bool)] bool bAbsolute,
     [In] SmallRect lpConsoleWindow);
コード例 #12
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool SetConsoleTextAttribute(
     SafeConsoleHandle hConsoleOutput,
     CharacterAttributes wAttributes);
コード例 #13
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool SetConsoleScreenBufferSize(SafeConsoleHandle hConsoleOutput, Coord dwSize);
コード例 #14
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
        /// <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;
        }
コード例 #15
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool FlushConsoleInputBuffer(SafeConsoleHandle hConsoleInput);
コード例 #16
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool WriteConsoleInput(
     SafeConsoleHandle hConsoleInput,
     InputRecord[] lpBuffer,
     uint nLength,
     out uint lpNumberOfEventsWritten);
コード例 #17
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool GetConsoleCursorInfo(
     SafeConsoleHandle hConsoleOutput,
     [In, Out] ConsoleCursorInfo lpConsoleCursorInfo);
コード例 #18
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
        /// <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;
        }
コード例 #19
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern Coord GetConsoleFontSize(SafeConsoleHandle hConsoleOutput, uint nFont);
コード例 #20
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool WriteConsoleOutput(
     SafeConsoleHandle hConsoleOutput,
     CharInfo[] lpBuffer,
     Coord dwBufferSize,
     Coord dwBufferCoord,
     [In, Out] SmallRect lpWriteRegion);
コード例 #21
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
        /// <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;
        }
コード例 #22
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool WriteConsoleOutputAttribute(
     SafeConsoleHandle hConsoleOutput,
     CharacterAttributes[] lpAttribute,
     uint nLength,
     Coord dwWriteCoord,
     out uint lpNumberOfAttrsWritten);
コード例 #23
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool GetConsoleScreenBufferInfoEx(
     SafeConsoleHandle hConsoleOutput,
     [In, Out] ConsoleScreenBufferInfoEx lpConsoleScreenBufferInfoEx);
コード例 #24
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
        /// <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;
        }
コード例 #25
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool GetCurrentConsoleFontEx(
     SafeConsoleHandle hConsoleOutput,
     [MarshalAs(UnmanagedType.Bool)] bool bMaximumWindow,
     [In, Out] ConsoleFontInfoEx lpConsoleCurrentFontEx);
コード例 #26
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool FillConsoleOutputCharacter(
     SafeConsoleHandle hConsoleOutput,
     char cCharacter,
     uint nLength,
     Coord dwWriteCoord,
     out uint lpNumberOfCharsWritten);
コード例 #27
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern Coord GetLargestConsoleWindowSize(SafeConsoleHandle hConsoleOutput);
コード例 #28
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
        /// <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;
        }
コード例 #29
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
        /// <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;
        }
コード例 #30
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
 public static extern bool SetConsoleActiveScreenBuffer(SafeConsoleHandle hConsoleOutput);