quote:Original post by Codegod
How do I set the properties for the console, such as window and buffer sizes??
SetConsoleWindowInfo is an API that sets the console size. If you want to explore using the hwnd to the console - you can get it with something like this:
HWND hConWnd = NULL; TCHAR szTempTitle[] = MY_CON_GUID; // use a GUID TCHAR szTempString[MAX_PATH]; if( GetConsoleTitle(szTempString, sizeof(szTempString)/sizeof(TCHAR) ) > 0 ) { SetConsoleTitle(szTempTitle); hConWnd = FindWindow(TEXT("tty"), szTempTitle); SetConsoleTitle(szTempString); }
But you might want to verify that "tty" is the correct classname using a window spy prog or something like that. "tty" was correct on W98 - on W2K its "ConsoleWindowClass"
For changing the buffer the API's are CreateConsoleScreenBuffer, GetConsoleScreenBufferInfo, SetConsoleScreenBufferSize and a few others. Here's a link to a console game that was posted in one of the flipcode totd's last year. The code illustrates several useful console techniques.
JCAB's Console Snake Game// EDIT - this link points to a lot of useful info - it asks the same question - you might even recognize the code snippet that jacksonh presented above - and goes a bit further with 'freopen' and alt+enter. I even got a little nostalgic looking at it as it was my first post ever at flipcode. How fast time flies...
[edited by - lessbread on March 23, 2002 5:50:55 PM]
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man