Problem with DirectInput8Create

Started by
12 comments, last by Harvester944 19 years ago
Quote:Original post by Evil Steve
EDIT: Actually, if buffer is a member variable, and is the first variable in your class, then your this pointer could be NULL. Although I very much doubt that you'd have the buffer as a member variable in your class.


I do. Is it a bad idea?

-Mezz
Advertisement
Quote:Original post by Mezz
Quote:Original post by Evil Steve
EDIT: Actually, if buffer is a member variable, and is the first variable in your class, then your this pointer could be NULL. Although I very much doubt that you'd have the buffer as a member variable in your class.


I do. Is it a bad idea?
Oh, I was getting confused, sorry. I was thinking of GetDeviceData, since there's no real reason you'd keep the buffer for that around. But keeping the value of GetDeviceState is perfectly reasonable.
Is buffer declared as a pointer? If so, has it been initialized by the time you call GetDeviceState? I'm with Evil on this one. It looks like your DirectInputDevice is NULL.

When you are dropped into the debugger, there should be a window with all of the variables currently in scope listed. You should be able to tell from that which one(s) is/are NULL.
Evil Steve and Dave Hunt were correct, the DirectInputDevice was NULL. The problem was not that I was accidently releasing it, nor was the device setup failing. The problem originated in the fact that my device setup function only created the device for that function(this was not intentional), meaning that while the error checking code inside the function thought I had a valid DirectInputDevice, once the program left that function I no longer did. It works now, I am glad you could help.

Thanks again,

-Harvester944

This topic is closed to new replies.

Advertisement