Sign in to follow this  

DirectInput - How to distinguish between XBox and other controllers?

This topic is 3741 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! I'm writing an enumeration callback function and I'm trying to distinguish between XBox 360 controllers and other brands of game controllers. How do I do that? Currently I'm using this code from within my RegularJoystickCallback() function...
	// Is this an XBox 360 controller?  If so, we use
	// XInput routines instead of DirectInput!
	if (strstr(pdidInstance->tszProductName, "Xbox 360"))
		return DIENUM_CONTINUE;
It's an extremely simple bit of code that looks for "Xbox 360" within the controller's name, and continues the enumeration if it's found. This works fine on my computer, but I doubt it would work where the XBox 360 controller may be called something different (for example, in a non-English speaking country). Is there something more reliable that you would recommend to me? Thanks in advance for the help!

Share this post


Link to post
Share on other sites
Thanks for the info, sirlemonhead. I tried that out in the past, but I couldn't find all of the dependencies and header files (files.lib, files.h) needed to get it to compile in Visual CPP.

If somebody could let me know what .lib and .h files I need to include, I'd like to use that code. It would definitely be more reliable than what I'm currently using! [smile]

Share this post


Link to post
Share on other sites

This topic is 3741 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this