   Associating a Window Procedure with the Console?
  Is it possible to create a peekmessage loop for the console that dispatches console messages to a window procedure? Anyone have some simple code showing this or a link to a discussion elsewhere?Thanks!   
  This is not possible. The console is a special invocation of cmd.exe and you are really limited to what you can do with it.The closest thing you can do to process console events is setup a console control handler using SetConsoleCtrlHandler. Here's a simply example showing it:#include <windows.h>#include <stdio.h>HANDLE hExitEvent = 0;BOOL __stdcall ConsoleHandler(DWORD ConsoleEvent){switch(ConsoleEvent){case CTRL_LOGOFF_EVENT:case CTRL_C_EVENT:case CTRL_BREAK_EVENT:case CTRL_CLOSE_EVENT:case CTRL_SHUTDOWN_EVENT:{SetEvent(hExitEvent);return TRUE;}}return FALSE;}int main(int argc, char * argv[]){hExitEvent = CreateEvent(0, TRUE, FALSE, 0);SetConsoleCtrlHandler(ConsoleHandler, TRUE);WaitForSingleObject(hExitEvent, INFINITE);SetConsoleCtrlHandler(ConsoleHandler, FALSE);return 0;}Normally, if you did not set the console control handler, you would get a "This application is not responding" dialog when you tried to close it. Since the close event is properly handled now, you can gracefully exit the console in any number of ways (ctrl + c, close the window, on demand).   ;  Great, thanks for the detailed response.   ;  Judging from your recent posts, it sounds like you want to create a "pretty" console window. If so, you might want to look at the source code for similar projects like  this one.   ;Quote:Original post by Drew_BentonThis is not possible.Of course it's possible and very classic (for timers or other)