Archived

This topic is now archived and is closed to further replies.

azariahsmith

Help: DirectInput init problems!?!

Recommended Posts

Hey. I''m trying to initialize DirectInput to use the keyboard. I''m getting the following unresolved external symbols and I don''t know why: _GUID_SysKeyboard _IID_IDirectInput8A _GUID_Key I have included "dinput.h" and I link "dinput8.lib". My short initialization function is below. The parameters ''hwnd'' and ''hInstance'' are initialized ok. Why am I getting these linking errors? email me at michael@engr.mun.ca if possible. Thanks in advance. -mike -=* CODE *=- LPDIRECTINPUT8 gDI; // DirectInput interface LPDIRECTINPUTDEVICE8 gDIKeyboard; // Keyboard device bool InitDirectInput(HWND hwnd, HINSTANCE hInstance) { // create the DirectInput object if (FAILED(DirectInput8Create(hInstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&gDI, NULL))) return false; // create the keyboard device if (FAILED(gDI->CreateDevice(GUID_SysKeyboard, &gDIKeyboard, NULL))) return false; // set the keyboard data format if (FAILED(gDIKeyboard->SetDataFormat(&c_dfDIKeyboard))) return false; // set cooperative level if (FAILED(gDIKeyboard->SetCooperativeLevel(hwnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE))) return false; // gain access to keyboard gDIKeyboard->Acquire(); return true; }

Share this post


Link to post
Share on other sites