   getch() function
  I''m trying to convert an old DOS program written in C, using VC++ and MFC. Looks like this program used getch() to read a character from a keyboard, but this function always returns -1 to me. Is it only supported in console mode? Does anyone know of a similar function? I need to determine what character was pressed from the keyboard when the window was in focus, so that I can execute the appropriate function within a switch block. 
  In non-console windows programs, windows posts a message when a key is pressed (to the active window) ...this message is WM_KEYDOWN I believe if you are not running TranslateMessage() in your message loop ... if you are, you will get a WM_CHAR message to your window ... look those two messages up in MSDN ..those are assuming your using a WinMain() style app and creating a window, and running a message loop ... ;  Yes but in MFC you don''t have a winmain function or a message loop. How would you do it then? ;  Override your window''s OnChar method. getch () is supported only for consoles. The fact that it is in conio.h should tell you so...   ;  read the microsoft sidekick for the console commandsgetch, getche, and kbhit all have new versions of them for win32 