Mikecrosoft
06-11-2002, 11:23 AM
I need know if DirectX is installed on the system, how I can do this ?
Thanks !!!
Thanks !!!
Detect DirectXMikecrosoft 06-11-2002, 11:23 AM I need know if DirectX is installed on the system, how I can do this ? Thanks !!! Pookie 06-12-2002, 05:01 AM You want to do this via VB or just to check if it installed? In the windows\system32 directory there is a file called dxdiag.exe which tells you all about the status of which Dx is installed on the comp. Mikecrosoft 06-12-2002, 11:22 AM I need it via Visual Basic Thanks !! BillSoo 06-12-2002, 11:29 AM Here is something I found in MSDN: Applications sometimes need to know which version of Microsoft® DirectX® is currently available on the system. For example, if an older version of DirectX is on the system, your application may need to scale itself to the capabilities of that version or install the most recent version. There is no direct way to obtain the DirectX version number. However, each version has a characteristic set of objects and interfaces. Because any version of DirectX supports all previous versions, this set of interfaces and objects will be supported by the version in which they are introduced and all subsequent versions. Thus, the preferred way to determine whether your desired version is available is to test for its characteristic objects or interfaces. As long as those are present, your application will work normally even though you might be using a more recent version of DirectX. For example, suppose you need version 6.1 support. The Microsoft DirectMusic® object (CLSID_DirectMusic) was introduced in DirectX version 6.1. You can test for the presence of the DirectMusic object by attempting to create it with CoCreateInstance. If you are successful, you have version 6.1 or later, and you will be able to use all the DirectX 6.1 capabilities. Rather than provide a detailed list here of each version's characteristic interfaces and objects, you should refer to the DirectX Software Development kit's sample section. One of the samples is a function, GetDXVersion, that includes tests for all DirectX versions. GetDXVersion returns an integer that corresponds to the DirectX version that is present on the system. As long as this integer is greater than or equal to your desired version number, your application will run normally. You can find the sample code under your SDK root folder at \Samples\Multimedia\DXMisc\GetDXVer. But it seems odd to me that you can't tell what version is installed directly.... Squirm 06-12-2002, 02:54 PM There is a DLL for detecting DirectX version. I've attached it to this post. Here are the declarations: Private Declare Function DirectXSetupGetVersion Lib "dsetup.dll" (dwVersion As Long, dwRevision As Long) As Long And to use: Dim lMajor As Long, lMinor As Long, rVal As Long ChDir App.Path rVal = DirectXSetupGetVersion(lMajor, lMinor) lMajor = lMajor - (lMajor And &H40000) lMinor = (lMinor - (100 * lMajor)) If lMajor < 7 Then '........ :) lebb 06-12-2002, 02:57 PM Ooh, nice find, Squirm! :) Mikecrosoft 06-13-2002, 02:06 PM Thanks for your help Squirm, but I have one question, What is the location of this DLL, in Windows/system or in the application path ? Thanks again !!! Mikecrosoft 06-13-2002, 02:35 PM OK, the previous quiestion is now solved, but other question, If DirectX is not installed in the system, the version number is 0 ? Thanks !!!!! Squirm 06-13-2002, 02:37 PM Of course.... what did you expect? gbslider 06-16-2002, 09:34 PM It's a simple way to detect whether or not directx is installed on a pc. Add the Local error to your Initialization sub (which you should have). If DX is not installed on the system, this will throw an error and you catch it at the bottom of the sub like this- Exit Sub 'if no error found then split NoDX: 'if error found then we start here Msgbox "Sorry- it appears that DirectX7 or higher is not installed on this computer or you may have hardware limitations." End (or do other things) End Sub While this demo is not as good as manually looking for DX on hard drives, error traps like this prevent your program from freezing should the user have problems unreleated to directx. A lame video card which doesn't support 800 by 600 by 32bit is an example. Best of luck!! gbslider JimCamel 07-04-2002, 07:45 AM Hey, I was wondering if anyone had the DX SDK downloaded, whether they'd be able to send the folder BillSoo talked about in his post: "You can find the sample code under your SDK root folder at \Samples\Multimedia\DXMisc\GetDXVer. " To jimcamel@jimcamel.8m.com. I don't really feel like downloading the 90mb for 1 folder which is probably a few hundred kb in size. Thanks. Jim AndreRyan 07-06-2002, 08:27 PM I found the program but its for C++ I would compile it but that would be breaking the forum rules JimCamel 07-07-2002, 06:27 AM Originally posted by AndreRyan I found the program but its for C++ I would compile it but that would be breaking the forum rules Thanks AndreRyan, I actually managed to find an FTP with the DX SDK already unzipped, and got the source from there. I've taken C courses at university and I understand the code, and was considering rewriting it in VB as a class module or something because I HATE trying to distribute dll files. But looking over the code is making me really wonder about whether it's worthwhile. Sure enough, all it does is tries to initialise various parts of DX and depending on the successes/failures, it can determine what version is running. Very poor foresight by microsoft if you ask me =/ Jim |
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum