How do I test for DirectX?

Started by
10 comments, last by Rob123 21 years, 7 months ago
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.
Advertisement
I never used it, but try to raed in the DSK help under DirectSetup
I would love going home to M7, but I can't detect black holes.
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**
[size=2]aliak.net
Problem is that it seems that as soon as the program runs it complains the DLLs are missing. Doesn''t even get as far as trying to do anything.
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.
~phil
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]
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
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.
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.
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
Member of the Unban Mindwipe Society (UMWS)

This topic is closed to new replies.

Advertisement