Files
PCK-Studio/MinecraftUSkinEditor/Classes/StoneVOX/utils/ConsoleUtil.cs
PhoenixARC 10f1c8daa0 update
2021-08-09 19:05:20 -04:00

29 lines
823 B
C#

using System;
using System.Runtime.InteropServices;
namespace stonevox
{
public class ConsoleUtil
{
[DllImport("kernel32.dll")]
static extern bool SetConsoleMode(IntPtr hConsoleHandle, int mode);
[DllImport("kernel32.dll")]
static extern bool GetConsoleMode(IntPtr hConsoleHandle, out int mode);
[DllImport("kernel32.dll")]
static extern IntPtr GetStdHandle(int handle);
const int STD_INPUT_HANDLE = -10;
const int ENABLE_QUICK_EDIT_MODE = 0x40 | 0x80;
public static void EnableQuickEditMode()
{
int mode;
IntPtr handle = GetStdHandle(STD_INPUT_HANDLE);
GetConsoleMode(handle, out mode);
mode |= ENABLE_QUICK_EDIT_MODE;
SetConsoleMode(handle, mode);
}
}
}