Advertisement Jump to content
Sign in to follow this  

DirectX input issues

This topic is 3644 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I've searched for a long time to find out more information about this particular issue I'm having with keyboard input in directx. I hope I haven't missed a former thread about this. If I have, please direct me and accept my apologies. The problem is this. When a key is held down for a few seconds, there is a period shortly afterwards that prevents other input events from happening immediately, although the initial key press responds correctly. The length of this period depends on the the length of time the key was held down. As an example, the 'w' key is pressed for 10 seconds and released and the response to both actions was immediate. I next attempt to use the mouse wheel for input, however it takes a few seconds for a response to actually happen. Also, the subsequent input of the mouse wheel is being remebered, so that in just few seconds all the actions will take place. I'm using, LPDIRECTINPUTDEVICE8 for both keyboard and mouse input, with the following intialization, din->CreateDevice(GUID_SysKeyboard, &dinkeyboard, NULL); din->CreateDevice(GUID_SysMouse, &dinmouse, NULL); dinkeyboard->SetDataFormat(&c_dfDIKeyboard); dinmouse->SetDataFormat(&c_dfDIMouse); dinkeyboard->SetCooperativeLevel(hWnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND); dinmouse->SetCooperativeLevel(hWnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND); For my mouse and keyboard functions, I acquire input with, dinmouse->GetDeviceState(sizeof(DIMOUSESTATE), (LPVOID)&mousestate); dinkeyboard->GetDeviceState(256, (LPVOID)keystate); additionally, I use windows events for some keys to, since they don't immediately repeat. LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { case WM_CHAR: switch (wParam) }, for example. After using DX input, the following are affected and require some time before they 'activate': DX mousewheel, windows keys, any type of event that is initiated by clicking on the window. As you can tell, I'm kind of a novice at this. My guess is that I'm flooding a buffer and it takes some time to empty out. Any advice is appreciated, h-bar btw, the program I'm referring to can be found at It's essentially a tool to turn images into 3D objects. It requires a stereoscopic interface for proper usage.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!