direct input help!!!

Started by
2 comments, last by Geminox 18 years, 10 months ago
i got the following error " Unhandled exception at 0x00421dc4 in test.exe: 0xC0000005: Access violation reading location 0x00000004. " with the following code.


bool CInput::Update(void)
{
	Keyboard->GetDeviceState(sizeof(UCHAR[256]),(LPVOID)&KeyBuffer);

	return true;
}

/

anyone know how i can fix this error?

Advertisement
My guess is that the value of this or Keyboard is 0. What does the debugger tell you?
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Debug

-&KeyBuffer 0x0000008 <Bad Ptr> char *
-this 0x0000000 {InputObject=??? Keyboard=??? KeyBuffer=0x0000008 CInput*const
---InputObject CXX0030: Error: expression cannot be evaluated
etc..


LPDIRECTINPUT8 InputObject;
LPDIRECTINPUTDEVICE8 Keyboard;
solved it! thx.

forgot to initkeyboard.

This topic is closed to new replies.

Advertisement