Error initializing DirectInput Object! [Archive] - C Board

PDA

View Full Version : Error initializing DirectInput Object!


SyntaxBubble
04-14-2002, 11:21 AM
When I use this code for DInput:

hr= (DirectInput8Create(0, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&lpdi, NULL));

if(FAILED(hr))
{
MessageBox(hWnd, "Error initializing DirectInput8 Keyboard Object!", 0, 0);

exit(1);
}


It pops up the Error Message when I run it. Are there any files I need?

Coder
04-15-2002, 05:12 AM
hr= (DirectInput8Create(0, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&lpdi, NULL));

if(FAILED(hr))
{
MessageBox(hWnd, "Error initializing DirectInput8 Keyboard Object!", 0, 0);

exit(1);
}
Try

hr = DirectInput8Create( GetModuleHandle( 0 ), DIRECTINPUT_VERSION,IID_IDirectInput8,(void**)&lpdi,NULL);

Generally, when anything DX fails, use the functions DXGetErrorString8( HRESULT ) & DXGetErrorDescription8( HRESULT ) which function exactly as their name says.

SyntaxBubble
04-15-2002, 02:53 PM
It says:

implicit declaration of int DXGetErrorString8(...);

Coder
04-15-2002, 09:46 PM
What have you done exactly?
It seems that you've tried to declare DXGetErrorString8 inside a function ( instead of calling it ).

Do you have DX8.1?
Post the code that caused that error, & the actual compiler message ( pointing out the line that caused the error )