DirectX9
-
-
I was able to do this on XP but I can't get any code to work on Win X64 could you give me an example. TNX
You have to look at the same path under the SOFTWARE\Wow6432Node\...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
You have to look at the same path under the SOFTWARE\Wow6432Node\...
A guide to posting questions on CodeProject[^]
Dave KreskowiakThis seems to be working. Any suggestions? I guess I will have to identify the OS and have an alternative for XP - right? Many thanks!
public void readRegistryForDX9()
{
RegistryKey rk = Registry.LocalMachine;
RegistryKey sk = rk.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX");
string temp = (string)sk.GetValue("Version");
if (temp.IndexOf("4.09")<0) MessageBox.Show("Directx 9 Must be installed");
else MessageBox.Show("Directx 9 already installed");
return;
} -
This seems to be working. Any suggestions? I guess I will have to identify the OS and have an alternative for XP - right? Many thanks!
public void readRegistryForDX9()
{
RegistryKey rk = Registry.LocalMachine;
RegistryKey sk = rk.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX");
string temp = (string)sk.GetValue("Version");
if (temp.IndexOf("4.09")<0) MessageBox.Show("Directx 9 Must be installed");
else MessageBox.Show("Directx 9 already installed");
return;
}You don't need to "read the OS". You just look under one registry path and if the value isn't there, you look under the other one. If it's not under either, DirectX isn't installed.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
This seems to be working. Any suggestions? I guess I will have to identify the OS and have an alternative for XP - right? Many thanks!
public void readRegistryForDX9()
{
RegistryKey rk = Registry.LocalMachine;
RegistryKey sk = rk.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX");
string temp = (string)sk.GetValue("Version");
if (temp.IndexOf("4.09")<0) MessageBox.Show("Directx 9 Must be installed");
else MessageBox.Show("Directx 9 already installed");
return;
}What Dave said above should do it. One note though - be sure to free any resources used by the
RegistryKey
objects - encolsing them inusing
statements is good:using (RegistryKey sk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX"))
{
// the rest of your code;
}It's also good practice to check
sk
fornull
as if the key's not present on the systemsk.GetValue("Version")
will thrown an exception. P.S. No need to explicitly return from avoid
method.2A
-
What Dave said above should do it. One note though - be sure to free any resources used by the
RegistryKey
objects - encolsing them inusing
statements is good:using (RegistryKey sk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX"))
{
// the rest of your code;
}It's also good practice to check
sk
fornull
as if the key's not present on the systemsk.GetValue("Version")
will thrown an exception. P.S. No need to explicitly return from avoid
method.2A