We have an application which needs to use Direct3D. Specifically, it needs at least DirectX 9.0c version 4.09.0000.0904. While this should be present on all newer XP machines it might not be installed on older XP machines. How can I programmatically (using C++) determine if it is installed? I want to be able to give an information message to the user that Direct3D will not be available.
我们有一个需要使用Direct3D的应用程序。具体来说,它至少需要DirectX 9.0c版本4.09.0000.0904。虽然这应该出现在所有较新的XP机器上,但它可能不会安装在较旧的XP机器上。我如何以编程方式(使用C ++)确定它是否已安装?我希望能够向用户提供Direct3D无法使用的信息消息。
4 个解决方案
#1
5
Call DirectXSetupGetVersion: http://msdn.microsoft.com/en-us/library/microsoft.directx_sdk.directsetup.directxsetupgetversion
调用DirectXSetupGetVersion:http://msdn.microsoft.com/en-us/library/microsoft.directx_sdk.directsetup.directxsetupgetversion
You'll need to include dsetup.h
你需要包含dsetup.h
Here's the sample code from the site:
以下是该网站的示例代码:
DWORD dwVersion;
DWORD dwRevision;
if (DirectXSetupGetVersion(&dwVersion, &dwRevision))
{
printf("DirectX version is %d.%d.%d.%d\n",
HIWORD(dwVersion), LOWORD(dwVersion),
HIWORD(dwRevision), LOWORD(dwRevision));
}
#2
0
According to the DirectX 9.0 SDK (summer 2004) documentation, see the GetDXVer SDK sample at \Samples\Multimedia\DXMisc\GetDXVer.
根据DirectX 9.0 SDK(2004年夏季)文档,请参阅\ Samples \ Multimedia \ DXMisc \ GetDXVer中的GetDXVer SDK示例。
#3
0
A quick Google search turns up this article which identifies the location of the version number in the registry and then provides a case statement which maps the internal version number to the version number we're more familiar with.
快速谷歌搜索出现了这篇文章,它在注册表中标识了版本号的位置,然后提供了一个案例陈述,它将内部版本号映射到我们更熟悉的版本号。
Another quick Google search turns up an example in C++ for reading from the registry.
另一个快速谷歌搜索在C ++中提供了一个从注册表中读取的示例。
Enjoy...
#4
0
Yes, use the mechanism shown in the DirectX Install sample in the March 2009 DirectX SDK. (Look under "System" category in the sample browser.)
是的,使用2009年3月版DirectX SDK中DirectX Install示例中显示的机制。 (在示例浏览器中查看“系统”类别。)
Do not use the registry! That stuff is undocumented and not guaranteed to work.
不要使用注册表!这些东西没有证件,也不能保证有效。
The only supported way is to use the DirectSetup API, which is shown in the DirectX Install sample. I also cover this stuff in Chapter 24. Installation and Setup in my book The Direct3D Graphics Pipeline. You can download that chapter for free at the above URL.
唯一受支持的方法是使用DirectSetup API,它显示在DirectX Install示例中。我还在第24章中介绍了这些内容。本书中的安装和设置Direct3D图形管道。您可以通过上述URL免费下载该章节。
#1
5
Call DirectXSetupGetVersion: http://msdn.microsoft.com/en-us/library/microsoft.directx_sdk.directsetup.directxsetupgetversion
调用DirectXSetupGetVersion:http://msdn.microsoft.com/en-us/library/microsoft.directx_sdk.directsetup.directxsetupgetversion
You'll need to include dsetup.h
你需要包含dsetup.h
Here's the sample code from the site:
以下是该网站的示例代码:
DWORD dwVersion;
DWORD dwRevision;
if (DirectXSetupGetVersion(&dwVersion, &dwRevision))
{
printf("DirectX version is %d.%d.%d.%d\n",
HIWORD(dwVersion), LOWORD(dwVersion),
HIWORD(dwRevision), LOWORD(dwRevision));
}
#2
0
According to the DirectX 9.0 SDK (summer 2004) documentation, see the GetDXVer SDK sample at \Samples\Multimedia\DXMisc\GetDXVer.
根据DirectX 9.0 SDK(2004年夏季)文档,请参阅\ Samples \ Multimedia \ DXMisc \ GetDXVer中的GetDXVer SDK示例。
#3
0
A quick Google search turns up this article which identifies the location of the version number in the registry and then provides a case statement which maps the internal version number to the version number we're more familiar with.
快速谷歌搜索出现了这篇文章,它在注册表中标识了版本号的位置,然后提供了一个案例陈述,它将内部版本号映射到我们更熟悉的版本号。
Another quick Google search turns up an example in C++ for reading from the registry.
另一个快速谷歌搜索在C ++中提供了一个从注册表中读取的示例。
Enjoy...
#4
0
Yes, use the mechanism shown in the DirectX Install sample in the March 2009 DirectX SDK. (Look under "System" category in the sample browser.)
是的,使用2009年3月版DirectX SDK中DirectX Install示例中显示的机制。 (在示例浏览器中查看“系统”类别。)
Do not use the registry! That stuff is undocumented and not guaranteed to work.
不要使用注册表!这些东西没有证件,也不能保证有效。
The only supported way is to use the DirectSetup API, which is shown in the DirectX Install sample. I also cover this stuff in Chapter 24. Installation and Setup in my book The Direct3D Graphics Pipeline. You can download that chapter for free at the above URL.
唯一受支持的方法是使用DirectSetup API,它显示在DirectX Install示例中。我还在第24章中介绍了这些内容。本书中的安装和设置Direct3D图形管道。您可以通过上述URL免费下载该章节。