DX Problems now :(

Started by
4 comments, last by titan2782 22 years, 2 months ago
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
Dustin DavisOwner / CEOProgrammers Unlimitedwww.Programmers-Unlimited.com
Advertisement
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.
Missed my signature.

Why make it simple when you can make it sooo nice and complicated?
Why make it simple when you can make it sooo nice and complicated?
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
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
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.
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...!
I'm don't know much but I can try to help... just email me at... Shadow_0f_Light@Yahoo.com(the '0' in 'Of' is a zero :P)

This topic is closed to new replies.

Advertisement