Ejemplo n.º 1
0
    public static void ClearConsoleHistory()
    {
        var chi = new CONSOLE_HISTORY_INFO();

        chi.cbSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(CONSOLE_HISTORY_INFO));
        if (!GetConsoleHistoryInfo(chi))
        {
            return;
        }
        var originalBufferSize = chi.BufferSize;

        chi.BufferSize = 0;
        if (!SetConsoleHistoryInfo(chi))
        {
            return;
        }
        chi.BufferSize = originalBufferSize;
        if (!SetConsoleHistoryInfo(chi))
        {
            return;
        }
    }
Ejemplo n.º 2
0
 public static extern bool SetConsoleHistoryInfo(
     CONSOLE_HISTORY_INFO ConsoleHistoryInfo
     );
Ejemplo n.º 3
0
 public static extern bool SetConsoleHistoryInfo(
     CONSOLE_HISTORY_INFO ConsoleHistoryInfo
     );
Ejemplo n.º 4
0
 static extern bool GetConsoleHistoryInfo(
     out CONSOLE_HISTORY_INFO ConsoleHistoryInfo
     );
Ejemplo n.º 5
0
 /// <summary>
 ///  Sets the history settings for the calling process's console.
 /// </summary>
 /// <param name="ConsoleHistoryInfo">A pointer to a <see cref="CONSOLE_HISTORY_INFO"/> structure that contains the history settings for the process's console.</param>
 /// <returns>If the function succeeds, returns TRUE, otherwise, retun FALSE.</returns>
 [DllImport("kernel32.dll", SetLastError = true)] public static extern bool SetConsoleHistoryInfo([In] CONSOLE_HISTORY_INFO ConsoleHistoryInfo);