[DllImport("kernel32.dll")]
static extern bool GetConsoleScreenBufferInfo(IntPtr hConsoleOutput,
out CONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
public struct COORD
{
public short X;
public short Y;
}
public struct SMALL_RECT
{
public short Left;
public short Top;
public short Right;
public short Bottom;
}
public struct CONSOLE_SCREEN_BUFFER_INFO
{
public COORD dwSize;
public COORD dwCursorPosition;
public short wAttributes;
public SMALL_RECT srWindow;
public COORD dwMaximumWindowSize;
}
None.
Please add some!
public static bool GetConsoleWindowSize ( out int cchWidth, out int cchHeight )
{
cchWidth = -1;
cchHeight = -1;
const int STD_OUTPUT_HANDLE = -11;
CONSOLE_SCREEN_BUFFER_INFO csbi;
if ( GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ), out csbi ) )
{
cchWidth = csbi.dwSize.X;
cchHeight = csbi.dwSize.Y;
return true;
}
return false;
}
Do you know one? Please contribute it!