   detecting key presses isn't working right =/
  I thought i got the gist of how keypresses were dected, but no matter how i code it i can't seem to get it to work...What i'm working towards is a fake CMD prompt setting. I'm making a very simple window app, with a black background. The reason i want this is because i like CMD text games, but sometimes it gets a little dreary reading all that, so i wanted a way to include a few pictures aswell. What my plan is, is to have it read keystrokes, and on alphanumeric keys have it print that to the screen, and have it do things such as capitals (shift + letter), enter, backspace, etc.However, for some reason it's not detecting my keypresses, and not printing what it should... I have a simple windows textout() function working fine. The way i do the key presses is: I am have a 256 bool array called keys[256]. When windows detects a key is being hit (WM_KEYDOWN) i set keys[wParam] = TRUE. If it detects a key up, i do the opposite. Then, up above in my windows message loop [while (GetMessage (&messages, NULL, 0, 0))] I have it print some string to the screen only if(keys[65]) (which should be a). For some reason though, no matter how long i hold a, or how many times i press it, that string (Hello World for now) never shows...I hope someone can help me^^ Thanks in advance.Mrow.   
  A bit more code would be useful...   ;  This is my program as of now:#include <windows.h>#include <cstdlib>#include <iostream>bool keys[256];/*  Declare Windows procedure  */LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);/*  Make the class name into a global variable  */char szClassName[ ] = "WindowsApp";int WINAPI WinMain (HINSTANCE hThisInstance,HINSTANCE hPrevInstance,LPSTR lpszArgument,int nFunsterStil){    HWND hwnd;/* This is the handle for our window */    MSG messages;  /* Here messages to the application are saved */    WNDCLASSEX wincl;   /* Data structure for the windowclass */    /* The Window structure */    wincl.hInstance = hThisInstance;    wincl.lpszClassName = szClassName;    wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */    wincl.style = CS_DBLCLKS;  /* Catch double-clicks */    wincl.cbSize = sizeof (WNDCLASSEX);    /* Use default icon and mouse-pointer */    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);    wincl.lpszMenuName = NULL;  /* No menu */    wincl.cbClsExtra = 0;  /* No extra bytes after the window class */    wincl.cbWndExtra = 0;  /* structure or the window instance */    /* Use Windows's default color as the background of the window */    wincl.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);    /* Register the window class, and if it fails quit the program */    if (!RegisterClassEx (&wincl))   return 0; /* The class is registered, let's create the program*/    hwnd = CreateWindowEx ( 0,    /* Extended possibilites for variation */ szClassName,    /* Classname */ "Windows App",  /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT,  /* Windows decides the position */ CW_USEDEFAULT,  /* where the window ends up on the screen */ 544,  /* The programs width */ 375,  /* and height in pixels */ HWND_DESKTOP,   /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance,  /* Program Instance handler */ NULL  /* No Window Creation data */ );    /* Make the window visible on the screen */    ShowWindow (hwnd, nFunsterStil);    /* Run the message loop. It will run until GetMessage() returns 0 */    while (GetMessage (&messages, NULL, 0, 0))    {   /* Translate virtual-key messages into character messages */   TranslateMessage(&messages);   /* Send message to WindowProcedure */   DispatchMessage(&messages); HDC    hDC;    PAINTSTRUCT Ps;    hDC = BeginPaint(hwnd, &Ps);SetTextColor(hDC, RGB(192,192,192));SetBkColor(hDC, RGB(0,0,0));   if(keys[65]) TextOut(hDC, 0, 0, "Hello World", 12);EndPaint(hwnd, &Ps);  }    /* The program return-value is 0 - The value that PostQuitMessage() gave */    return messages.wParam;}LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){   switch (message)   /* handle the messages */    {case WM_KEYDOWN:// Is A Key Being Held Down?{keys[wParam] = TRUE;}case WM_KEYUP:// Has A Key Been Released?{keys[wParam] = FALSE;// If So, Mark It As FALSEreturn 0;// Jump Back}   case WM_DESTROY:  PostQuitMessage (0);  /* send a WM_QUIT to the message queue */  break;   default:  /* for messages that we don't deal with */  return DefWindowProc (hwnd, message, wParam, lParam);    }    return 0;};  In your game loop:if(GetAsyncKeyState(VK_LEFT)){   //do something}VK means Virtual Key (LEFT,SHIFT and so on work)that what you were looking for?   ;  I just tried that and it didn't work either =/ I replaced the if(keys[65]) TextOut(hDC, 0, 0, "Hello World", 12); statement in my code above with:if(GetAsyncKeyState(VK_LEFT)){   TextOut(hDC, 0, 0, "Hello World", 12);}and it stll doesn't respond =(Meow.   ;  if your making a console text game why dont you just use cin >> ?  If its strictly a text game why are you using a windows gui??   ;  Because I want to include a few pictures here and there. You can't really pop color and .bmp files into a CMD prompt, which leaves it look somewhate dreary. A game that wears at your eyeballs is one people might stop playing. So i was hoping to spruce it up a bit, run it in a window pretty much the same as a cmd prompt, but with some pictures and color added^^   ;  Hmm... i did a test, and it's not the key detection that's not working... for some reason it's the output that's faulty. Here's my message handeling chunk of code:LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){HDC    hDC;    PAINTSTRUCT Ps;    hDC = BeginPaint(hwnd, &Ps);   switch (message)   /* handle the messages */    {case WM_KEYDOWN:// Is A Key Being Held Down?{keys[wParam] = TRUE;if(GetAsyncKeyState(VK_LEFT)){FILE *pFile;pFile = fopen("Test.txt","a");fprintf(pFile, "w00t!");fclose (pFile);SetTextColor(hDC, RGB(192,192,192));SetBkColor(hDC, RGB(0,0,0));TextOut(hDC, 0, 0, "Hello World", 12);EndPaint(hwnd, &Ps);}}case WM_KEYUP:// Has A Key Been Released?{keys[wParam] = FALSE;// If So, Mark It As FALSEreturn 0;// Jump Back}   case WM_DESTROY:  PostQuitMessage (0);  /* send a WM_QUIT to the message queue */  break;   default:  /* for messages that we don't deal with */  return DefWindowProc (hwnd, message, wParam, lParam);    }    return 0;}I have it write a string to a test.txt file everytime that key is pressed, and i also ahve it display text. Now, if i press left three times, the .txt file has three of the string in it, but the text never once shows. For some reason the text output function is erroring up... anyone have any ideas why that is?Mreow.   ;  I just want to interject that using the debugger and placing a breakpoint at that statement probably would have saved you a lot of time.Another thing, I'm not sure how much this matters but it appears that your function will call BeginPaint a whole lot of times but EndPaint only on a key down message.It's been years since I've done any rendering with a device context but I would probably look at any initializations you are doing (or not doing).  Maybe you need to specify a font?  Maybe your text output is getting painted over the next frame so you never see it?   ;  I moved the BeginPaint function further in and noc hange in results. Also, even if it where being written over, if i hold the key down it should re-write it each time it would be written over, and still show up. However, even if i hold the key down, nothing shows up. Also, it prints the text if i ahve it outside of any conditional statements (such as if statements or switch(cases))Also, i'm using Dev C++ as my compiler.   