Advertisement

DirectInput, how do I make a KEY_UP?

Started by May 12, 2003 05:26 PM
0 comments, last by dario_s 21 years, 9 months ago
Im trying to make a keyup function, and I just can''t figure out how to do it in a smart way Anyone know how? Please help me!
        

#define KEY_DOWN(key) (key_buffer[key] & 0x80)


void cInput::DInput_Update()
{
		HRESULT hr;
	
		//First, check to see if the keyboard is still working/functioning

		hr = (lpdi_keyboard->GetDeviceState(sizeof(UCHAR[256]),(LPVOID)&key_buffer));
    
		if(FAILED(hr))
		{
			if(hr==DIERR_INPUTLOST)
			{
				//Try to re-acquire the keyboard

				hr = (lpdi_keyboard->Acquire());
						
				if(FAILED(hr))
				{
					MessageBox(g_HWND, "Keyboard has been lost", "dInput error", MB_OK);
					DInput_Shutdown();
				}
			}
		}
}

    
I solved it, if anyones intrested, check out
http://www.gamedev.net/community/forums/topic.asp?topic_id=156477

This topic is closed to new replies.

Advertisement