|
|
|
#1 |
|
Registered User
Join Date: Jun 2005
Posts: 179
|
Detect Sound Card
I'm wondering if SWF Studio can detect that a sound card is installed on a machine. I want to be able to interrogate the machine for this so I can show or hide buttons for sound activities. If this is possible I'll appreciate an example.
|
|
|
|
|
|
#2 |
|
Tim
Join Date: May 2001
Location: Ottawa
Posts: 11,874
|
One way is to look under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum for something that looks like a sound card. The PCI key should contain an entry for all installed PCI cards. Picking the sound card out of this is not going to be easy.
A better way is to call WMI from JScript and let WMI do all the heavy lifting. I've attached an example that shows how to enumerate sound devices using WMI. It basically scans the same portion of the registry as above and returns a list of sound devices. If you get nothing back, there's no sound card. |
|
|
|
|
|
#3 |
|
Registered User
Join Date: Jun 2005
Posts: 179
|
That's a thing of beauty! Thanks, Tim.
|
|
|
|
|
|
#4 |
|
Tim
Join Date: May 2001
Location: Ottawa
Posts: 11,874
|
Search for "WMI" here in the forums and you'll find a bunch of other goodies I've posted over the years that take advantage of WMI using the same approach.
|
|
|
|
|
|
#5 |
|
Registered User
Join Date: Jun 2005
Posts: 179
|
Very educating. Thanks for pointing me in that direction.
|
|
|
|