Archived

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

RegularKid

Direct Input Help...

Recommended Posts

Here''s what i''ve done to start my direct input test and for some reason it''s not working. Please tell me what i did wrong. 1. Made sure that c:\mssdk was at the top of the list in both the includes and the libs directories 2. Added dinput.lib to my link settings 3. Here''s my code myInput.cpp: LPDIRECTINPUT lpdi = NULL; void DIInit(void) { // Create the main direct input device DirectInputCreate(hInst,DIRECTINPUT_VERSION,&lpdi,NULL); } void DIKill(void) { // Release the main direct input device if(lpdi) { lpdi->Release(); } } I call these functions from my main program (this code also has a header file associated with it) When I go to compile, it tells me that DirectInputCreate is an undeclared identifier. What am i doing wrong? Thanks!

Share this post


Link to post
Share on other sites
No, I tried that and it still doesn''t work. It keeps telling me that DirectInputCreate() is an undeclared identifier. Thanks though, and sorry about the double post thing (i get better responses that way)

Share this post


Link to post
Share on other sites
No, that still didn''t work. I know that the function DirectInputCreate() exists because when i type it in code, the little VC++ function popup comes up and tells me what parameters i need to pass into the function. But when I go to compile it, it tells me that the DirectInputCreate is an ''undeclared identifier''. But I know for sure that i added dinput.lib to my link settings and that i did #include . What is going on?!

Share this post


Link to post
Share on other sites
If you''re using the DX8 SDK and want to use DirectInputCreate() which is pre-DX8, then you must do:
#define DIRECTINPUT_VERSION 0x0700
BEFORE the line:
#include

Share this post


Link to post
Share on other sites
Here''s the breakdown. To use DX8, use DirectInput8Create(), LPDIRECTINPUT8, include dinput8.h and link with dinput8.lib. MSVC has no help for these functions/types, but a .chm help file is included in the SDK download.

To use earlier versions of DirectX, drop the 8 and #define DIRECTINPUT_VERSION to the appropriate version (0x0700 for DX7).

Share this post


Link to post
Share on other sites