Direct Input Help...

Started by
6 comments, last by RegularKid 22 years, 5 months ago
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!
Advertisement
1.) LPDIRECTINPUT8 lpddi; // note the 8!
2.) DirectInput8Create(); // again, note the 8


To you it''s a Bently, to me it''s a blue car...
"Diddy"
P.Diddy
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)
Try adding dinput8.lib to your project, not dinput.lib!

greetz,
netjockey

Edited by - netjockey on October 22, 2001 6:20:56 AM
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?!
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
Dirk =[Scarab]= Gerrits
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).
Cool! It finally works. Thanks Scarab0.

This topic is closed to new replies.

Advertisement