Original Post
I have tried several direct input resources to try to create direct input working within my own project. But I just can't seem to get it to work and I don't know what I'm doing wrong. The first part of the code I have this: bool initDirectInput() { if(FAILED(DirectInput8Create(_pGame->GetInstance(), DIRECTINPUT_VERSION, IID_IDirectInput8, (void **)&pDI, NULL))) { // error - unable to obtiain DirectInput interface return false; } if(FAILED(pDI->CreateDevice(GUID_SysKeyboard,&pKeyboard,NULL))) return false; if (FAILED(pKeyboard->SetDataFormat(&c_dfDIKeyboard))) return false; if(FAILED(pKeyboard->SetCooperativeLevel(_pGame->GetWindow(), DISCL_FOREGROUND | DISCL_NONEXCLUSIVE))) return false; pKeyboard->Acquire(); return true; } But this all seems to work since it doesn't give me an error when it returns false, so I think it is ok. Now as second part in my HandleKeys function I got this piece of code: HRESULT hr; BYTE diks[256]; if( NULL == pKeyboard ) MessageBox(NULL, "No keyboard?", "ERROR", MB_OK); ZeroMemory( diks, sizeof(diks) ); if(FAILED(hr = pKeyboard->GetDeviceState(sizeof(diks[256]), diks))) { while(hr == DIERR_INPUTLOST) pKeyboard->Acquire(); if(hr == DIERR_OTHERAPPHASPRIO) MessageBox(NULL, "Other has priority", "ERROR", MB_OK); if(hr == DIERR_NOTACQUIRED) MessageBox(NULL, "Keyboard is not acquired", "ERROR", MB_OK); return false; } Here I am receiving the Keyboard is not acquired error. I don't know how to fix it though, have tried looking at multiple resources for several hours now but I just cant find what I'm missing or doing wrong.