• Advertisement

Archived

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

Help: DirectInput init problems!?!

This topic is 5741 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Guest Anonymous Poster
Never mind. I got it solved. I didn''t define INITGUID first.

-m

Share this post


Link to post
Share on other sites

  • Advertisement