Some one help beore I smash in my monitor. DInput 8 is not playing nice with Borland

Started by
10 comments, last by ElNoNombreHombre 22 years, 5 months ago
Hello. This is my second plea for help on this subject, the first round was very helpful in eliminating all the linker errors, however, now i have a bigger problem. Something is failing in the inital Direct Input object creation. I am attempting to create a class wrapper around DInput8 and it''s compiling and even linking fine (I''m using the [sorry if I massacre the spelling] Fotsch libs]. Here is the code in qestion:
  
bool InputSystem::Initalize(HWND hWnd, HINSTANCE hAppInstance, bool isExclusive,
DWORD flags)
{
        // create a DI opject

        // otherwise return false

        if(FAILED(DirectInput8Create(   hAppInstance,      // the handle of the app instance

                                        DIRECTINPUT_VERSION,    // input version

                                        IID_IDirectInput8,      // whaever this is -- could someone answer this part too?

                                        (LPVOID*)&lpDI8,        // the LPDirectinput8 object

                                        NULL)))                  // we don''t need the com stuff)

        {
                return false;
        }
  
which is called from this:
  
Input->Initalize(hWnd, hInstance, true, IS_USEMOUSE | IS_USEKEYBOARD)
  
If you think you recognizze this it''s because im creating it based on the wrapper in the OpenGL Game Programing book. my problem is it never gets past this point... could someone who''s figured out this conundrum please help me? by the way, I like doing things the hard way so please no RAD development helper tool thingies please. Thanks in advance. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To all of those who think I''m just being contradictory: No I''m not!
To all of those who think I'm just being contradictory:No I'm not!My First Game!!!"
Advertisement
Is that the whole function? That code matches mine except for some minor syntax things, and of course identifier names, but looks like it works OK to me. What else is within the Initialize function--are you SURE that it''s the DI8Create call that''s bombing?
yes, I''m sure, I used about billion break points (and I never, EVER exaderate ), making sure I found what went wrong.

since it fails on that I didn''t figure I needed to post the rest of the code.

That and I didn''t want to do a massive code dump.

Thanks for attempting to point out the obvious.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To all of those who think I''m just being contradictory:

No I''m not!
To all of those who think I'm just being contradictory:No I'm not!My First Game!!!"
The usual things to check would be to see if your hInstance is valid. I usually use the function GetModuleHandle(NULL) which will work as long as your program is in a single thread.

Other than that, every thing looks fine.

What is your HRESULT from that line? The docs say it can only be the following things:

DIERR_BETADIRECTINPUTVERSION
DIERR_OLDDIRECTINPUTVERSION
DIERR_INVALIDPARAM
DIERR_OUTOFMEMORY

If it is one of the first two, than you are linking with the old dinput libraries. If it is an invalid parameter, than you could look at that (who knows!), or if it is out of memory... try restarting your machine!

Other than that, I don''t know!

Good luck,
/jk
heh... its none of them... its not even DI_OK... this is weird...

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To all of those who think I''m just being contradictory:

No I''m not!
To all of those who think I'm just being contradictory:No I'm not!My First Game!!!"
although the HRESULT value is == 3. what does that mean?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To all of those who think I''m just being contradictory:

No I''m not!
To all of those who think I'm just being contradictory:No I'm not!My First Game!!!"
Help... does, anyone know what''s going on here? I''m getting desperate... rather, I''m getting more desperate.

Any one?
(empty hall echoes)
Any one?
Any one?
Any one?
Any one?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To all of those who think I''m just being contradictory:

No I''m not!
To all of those who think I'm just being contradictory:No I'm not!My First Game!!!"
Real stupid question, but do you have the DX8 runtime installed??
Maybe everything compiles and runs properly, but you don''t have the proper RUNTIME....(hey man, I''m trying to help and grasping for straws..*grin*)

"Throw me a bone, people."
Learn about game programming!Games Programming in C++: Start to Finish
Just for fun, use DXGetErrorString8( hr ) to see what string it returns. Identifying what the error is should be first priority.
But remember, that function, I think I read, returns OUT OF MEMORY if it can not match it. So at least see if it gives you something usefull.
This is how I create my dinput instance:

DirectInput8Create( GetModuleHandle( NULL ), DIRECTINPUT_VERSION,
IID_IDirectInput8, (void **) &lpDInput, NULL );

One more advice:

If you are using other DX objects (DirectDraw for example) always use the same handle. I''ve done a mistake creating my DDraw object with the Application->Handle and my DInput object with the Form''s Handle and things did not work. It took me hours to undestand why...

hope it helps...

André

"- To begin with, said the Cat, a dog''s not mad. You grant that?
- I suppose so, said Alice.
- Well, then, - the Cat went on - you see, a dog growls when it''s angry, and wags its tail when it''s pleased. Now I growl when I''m pleased, and wag my tail when I''m angry. Therefore I''m mad."
"- To begin with, said the Cat, a dog's not mad. You grant that? - I suppose so, said Alice. - Well, then, - the Cat went on - you see, a dog growls when it's angry, and wags its tail when it's pleased. Now I growl when I'm pleased, and wag my tail when I'm angry. Therefore I'm mad."

This topic is closed to new replies.

Advertisement