   dx multi threading and input
  I have the following code which basically just clears a window to blackand looks for a keypress to stop processing the loop. Its running under directxin a seperate thread from the main window message pump, so I can program myprogram in a linear fashion. However I'm having problems detecting any input.Is there something wrong with the way I'm doing this?Any help gratefully received.while(!bExit){unsigned charkeys[256];GetKeyboardState(&keys[0]);//..'S' to stop loopif ( keys[0x53] & 0x80  ){bExit = true;} //this bit is just an abstraction //on direcx begin scene and clear callsDev2D_BeginScene();  Dev2D_Clear(0);Dev2D_EndScene();Dev2D_Flip();}   
  I think you need to poll your device before calling GetKeyboardState.  See IDirectInputDevice8::Poll in the DX docs (or by clicking here).  HTH.   ;  @Del Snd of Thndr: GetKeyboardState is a Win32 function, and is different to IDirectInputDevice8::GetKeyboardState().@MarkyMark: Does it work if you put the same code in the main thread? Does GetKeyboardState() return any error? Are you sure that the loop isn't exiting? Have you tried adding some other code such as exit(1); or a MessageBox()?   ;thanks I solved the problem.I did'nt read the documentation for GetKeyboardState since I've been so usedto using it for single threaded applications, that I missed the fact thatyou need to attach input to a seperate thread using the 'AttachThreadInput'call for it to register.Mark