# Real quick question about determining preprocessor version of DirectX.

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

## Recommended Posts

Hello, I have a real quick question about determining the version of DirectX during preprocessing. I want to include some typedefs if (and only if) the DirectX version is version 9. I would like these to be included using preprocessor definitions. In searching the internet it seemed to be that ... #if(DIRECT3D_VERSION == 0x0900) ... #endif would be the proper solution but I could not find a definitive answer. Is the above definitively correct? Thank you for your help. Jeremy

##### Share on other sites
Looks alright to me.

Digging around in the MS provided headers should yield similar code fragments, so you can double-check there.

Off the top of my head I can't remember which, but there are definitely some of the values (I think it might just be D3DX_VERSION) aren't officially defined as such - a new SDK could change them to anything it wants thus rebuilding your code and only changing the SDK could well break. I think there are comments to this effect in the code files though.

hth
Jack

##### Share on other sites

All I could find were snippets such as ...

#ifndef DIRECT3D_VERSION#define DIRECT3D_VERSION 0x0900#endifif(DIRECT3D_VERSION >= 0x900)...#endif

So, I am assuming that 0x0900 means DirectX 9 when compared with DIRECT3D_VERSION but again I just simply cannot find a definitive answer that absolutely verifies this.

Jeremy

##### Share on other sites
I think it's safe to assume that's correct. There's also DIRECTINPUT_VERSION, which is defined at 0x0800 - Since DI only goes up to v8. There's probably similar ones for the other DirectX components.