Archived

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

How do I test for DirectX?

This topic is 5585 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

Howdy Sorry if this has been answered before but the forum searches arn''t working. I''ve got all my DirectX stuff going nicely. I''m using mainly DirectMusic and DirectInput. The problem I''m having is with using it on machines that don''t have DirectX installed (or don''t have the correct version). How do I test for the required DLL''s? And what are they? I''d like to stop the "The DLL was not found in..." messages and either replace them with something useful or just work around and have no sound or whatever. Is that possible? Thanks again. Rob.

Share this post


Link to post
Share on other sites
hello

i suppose when you create the device...if it fails, that means that they dont have the correct versio of directX.
for directMusic you''d check this when you claeed CoCreateInstance(), and for input DirectInput8Create()

someone correct me if im wrong



"We call em ''natural disasters'' but ''he'' (or she?) calls them memory leaks!!"
Al
**MY HQ**

Share this post


Link to post
Share on other sites
You''ll have to dynamically link to the DLLs, instead of compiling it with the .lib files. I believe there''s an article on GDnet that describes just that - just do a search for it.
"Dynamic library linking" is what you''re looking for though. If you have Game Programming Gems 2 [or possibly it was in 3?] then it''s also in there. Web resources should be enough though.

- JQ
Full Speed Games. Coming soon.

Share this post


Link to post
Share on other sites
a (much) easier way that works for msvc6+ is to use dll delay-loading.

edit: right, the original question. do a LoadLibrary("blah.dll") and see if it returns a valid handle. use the delay-loading feature so that you can start your exe even if blah.dll is not present on the system.

[edited by - niyaw on September 2, 2002 5:08:26 PM]

Share this post


Link to post
Share on other sites
check the sdk for a sample which shows the version of dx on a machine. I remember reading the code once.

all you do is check if the dll is in windows directory. If there, then create the ddraw interface. Then query for other versions. If the query fails, then that version is not available. example. If ddraw4 fails, then the dx version is 3. if d3d8 is missing, then the version is prior to 8.

Its my duty, to please that booty ! - John Shaft

Share this post


Link to post
Share on other sites
As jwalker mentioned, there''s a nice little program in:
$SDKdir/samples/Misc/GetDXVer/
It works nicely to determine which version (if any) of DirectX is installed.

Share this post


Link to post
Share on other sites
Thanks for all the responses. I''m trying them out now.

One question tho: do all copies of Windows have at least an old version of DirectX? Does even NT come with something like DX3?

I was setting up DInput using DirectInput8Create() but that gives errors if people don''t have v8 right?

So I redid it using the old .h and DirectInputCreate(). This doesn''t seem the right way to go about it tho?

Is there a set of functions that just uses the latest version available?

Hope that makes sense.

Thanks again.

Share this post


Link to post
Share on other sites
quote:

One question tho: do all copies of Windows have at least an old version of DirectX? Does even NT come with something like DX3?


Nope. E.g. Windows 98 may not have DX installed at all (e.g. just after youve installed windows)

quote:

Is there a set of functions that just uses the latest version available?


Nope. You need to know what version you''re interface pointer is to be able to use it, otherwise you''ll be calling functions that don''t exist.

As jwalker said, there was/is a sample program with the DX SDK that gives the version of DX installed - or it might have been the version of DDraw.

Steve
DirectX Programmer
Soon to be the new Bill Gates

Share this post


Link to post
Share on other sites
Hmmm. I''m a little confused.

If there''s no version of DirectX installed, how will you be able to tell what version is there?

Wont the program give a "Missing DLL" error since DirectX isn''t there to be tested? So the program fails before it tests?

Or am I stupider than a labotomized goldfish?

Rob.

Share this post


Link to post
Share on other sites
nt4 comes with dx3, 98 i believe comes with dx6 or dx6.1, 2k ships with dx7 and xp has dx8.1. not sure if 95 has any dx in it.

by using dll delayloading or explicit dll loading via LoadLibrary you can start your exe even if it''s linked to missing dlls.

Share this post


Link to post
Share on other sites