#### Archived

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

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

## Recommended Posts

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!

##### Share on other sites
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?

##### Share on other sites
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!

##### Share on other sites
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_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

##### Share on other sites
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!

##### Share on other sites
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!

##### Share on other sites
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!

##### Share on other sites
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."

##### Share on other sites
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.

##### Share on other sites
This is how I create my dinput instance:

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

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."

##### Share on other sites
OK first I''d like to say a BIG thanks to all who have helped thus far and I think the bug is a few taps of the keyboard and a click of the mouse from being squashed.

However in a related story it appears that it may not be a bug at all...

reason being that after fighting my computer to not freeze up, and getting frustrated with Borland... I went to my Intro edition of MSVC++6.0... I run the program and I am, to my great delight and dismay given a Message Box that read the translated HRESULT of 3.

It''s String returned?

S_OK

Now, could someone tell me what in the Sam Hill that means (sorry, I''m a little flustered and I need to vent)? And if it''s what one of my friends thinks it is, saying that it means everything went ok... why did the FAILED marco return true?

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

No I''m not!

##### Share on other sites
Ok... after looking at the code, thoroughly perplexed... i discovered the following horrifying mistake:

  if(hres = DI_OK)

yea... hopefully astute programeres can see where this is going

however i fixed it and got a REAL error

E_POINTER.

Great. Now what...

HELP!!!!!!!!!!!!

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

No I''m not!

• ### Forum Statistics

• Total Topics
628345
• Total Posts
2982192

• 9
• 24
• 10
• 9
• 13