I want to have multiple consoles in a program, and switch between them.
So I can have multiple screens the user can swap between by pressing a button... that would be especially useful for debugging.
I know I'm not doing this exactly right, but I don't know exactly how to do so.Code:#include <iostream.h> #include <windows.h> #include <conio.h> int main() { HANDLE oldConsole = GetStdHandle(STD_OUTPUT_HANDLE); int junk; cout << "Old!" << endl; getch(); HANDLE newConsole = CreateConsoleScreenBuffer(GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CONSOLE_TEXTMODE_BUFFER, NULL); FreeConsole(); cout << "This shouldn't show up" << endl; SetConsoleActiveScreenBuffer(newConsole); system("cls"); cout << "New!" << endl; getch(); system("cls"); FreeConsole(); SetConsoleActiveScreenBuffer(oldConsole); return 0; }
I know there is a way to do it with the Console APIs... http://msdn.microsoft.com/library/de..._functions.asp



LinkBack URL
About LinkBacks


