Ejemplo n.º 1
0
        public ConsoleWrapper(short bufferWidth, short bufferHeight)
        {
            _bufferWidth  = bufferWidth;
            _bufferHeight = bufferHeight;

            //uint x = GetConsoleOutputCP();
            //bool b = SetConsoleOutputCP(1252);
            //bool b = SetConsoleOutputCP(850);
            //bool b = SetConsoleOutputCP(1250);

            h = CreateFileW("CONOUT$", 0x40000000, 2, IntPtr.Zero, FileMode.Open, 0, IntPtr.Zero);

            //uint x = GetConsoleOutputCP();
            //bool b = SetConsoleOutputCP(1252);
            //bool b = SetConsoleOutputCP(850);

            if (h.IsInvalid)
            {
                throw new InvalidOperationException("Unable to get handle to console window.");
            }

            buf  = new CharInfo[_bufferWidth * _bufferHeight];
            rect = new SmallRect()
            {
                Left = 0, Top = 0, Right = _bufferWidth, Bottom = _bufferHeight
            };
        }
Ejemplo n.º 2
0
 static extern bool WriteConsoleOutputW(
     SafeFileHandle hConsoleOutput,
     CharInfo[] lpBuffer,
     Coord dwBufferSize,
     Coord dwBufferCoord,
     ref SmallRect lpWriteRegion);