Original Post
hey i got this strange thing.... i complie it and it get no error, but then when i run it MsVs .net ends it and get´s me an break error! here is the code! best regard Me.
bool InputD3D(HINSTANCE hInst, HWND wndHandle)
{
hr = DirectInput8Create(hInst, DIRECTINPUT_VERSION, IID_IDirectInput8,
(void**)&din, NULL);
if(FAILED(hr))
{
return FALSE;
}
hr = din->CreateDevice(GUID_SysKeyboard, &dinkey, NULL);
if(FAILED(hr))
{
return FALSE;
}
hr =dinkey->SetDataFormat(&c_dfDIKeyboard);
if(FAILED(hr))
{
return FALSE;
}
hr = dinkey->SetCooperativeLevel(wndHandle, DISCL_BACKGROUND);
if(FAILED(hr))
{
return FALSE;
}
return TRUE;
}
void DInput(void)
{
static BYTE keystate[256];
dinkey->Acquire();
dinkey->GetDeviceState(256, (LPVOID)keystate);
if(keystate[DIK_W] &0x80)
MessageBox(NULL,"W är ned tryckt?","You made it idot",MB_OK);
return;
}