Archived

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

titan2782

DX Problems now :(

Recommended Posts

I can run my program, it compiles fine, but when it wont initialize! It errors out trying to initialize DX if ( DirectInputCreateEx( hInstance, // Window Instance DIRECTINPUT_VERSION, // Direct Input Version IID_IDirectInput7, // Version 7 (void**)&g_DI, // Direct Input NULL ) ) // NULL Parameter { MessageBox(NULL,"Couldnt initialize DI","",MB_OK); return(false); // Couldn''t Initialize Direct Input } errors out on this if statement in the DI_Init() function y? I am using the dx7 lib files and header files, but i have dx8.1 installed on my system. Dustin Davis

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by titan2782
if ( DirectInputCreateEx( hInstance, // Window Instance
DIRECTINPUT_VERSION, // Direct Input Version
IID_IDirectInput7, // Version 7
(void**)&g_DI, // Direct Input
NULL ) ) // NULL Parameter
{
MessageBox(NULL,"Couldnt initialize DI","",MB_OK);
return(false); // Couldn''t Initialize Direct Input
}




I am a little confused. Shouldn''t you put a ! before the call to the function. To me, your code seems to say

IF this function call succeedsTHEN
MSGBOX: this function call did NOT succeed!!!

Just a thought.

Share this post


Link to post
Share on other sites
hey,

use dx8. since dx7 and dx8 are fundamentally quite different and dx7 not being at all as "capable" as dx8, IMO it seems like an awful waste of time and effort to learn them both
that aside, could you be more specific - what kind of errors? if you''re willing to switch to dx8, i can send you a "gold standard" di init and handling module that i''ve got working and you could use that plus, depending on which compiler you use, i could possibly point out anything you might be missing.

ps - this IS an openGL forum and most of the replies to dx-related questions won''t be as professional and thorough as they would be in a dx forum(Choose from a list here).

crispy

Share this post


Link to post
Share on other sites
I think DI_OK is defined as 0 as are D3D_OK and DD_OK. Your code seems correct in that all error messages are not zero. I have had similar problems with DirectPlay. I have literally copied and pasted code from demo to my own project, and it has still failed. I have no solution to this.

Share this post


Link to post
Share on other sites
I had similar problems with Direct Input my self this is what I did. Best I can tell Visual Studio 6.0 ships with DX5 stuff, so I modified the code to work for that this is what I got...

  
if (!DirectInputCreate( hInstance, // Window Instance

DIRECTINPUT_VERSION, // Direct Input Version

IID_IDirectInput, // Version 5

NULL ) ) // NULL Parameter

{
MessageBox(NULL,"Couldnt initialize DI","",MB_OK);
return false; // Couldn''t Initialize Direct Input

}


that should with VC++ 6.0 out of the box. If you have any other Direct X problems and you have the full MSDN collection Direct X 5 is full documented. It''s not the newest but it gets the job done. Hope that helps...!

Share this post


Link to post
Share on other sites