Rob Hoelz
Rob Hoelz

Reputation:

Retrieving graphics/sound card information on Windows

I'm working on a bug reporting tool for my application, and I'd like to attach hardware information to bug reports to make pinpointing certain problems easier. Does anyone know of any Win32 API functions to query the OS for information on the graphics and sound cards?

Thanks, Rob

Upvotes: 1

Views: 5207

Answers (2)

toad
toad

Reputation: 1351

If your willing to dig into WMI the following should get you started.

using System;
using System.Management;

namespace WMIData
{
    class Program
    {
        static void Main(string[] args)
        {
            SelectQuery querySound = new SelectQuery("Win32_SoundDevice");
            ManagementObjectSearcher searcherSound = new ManagementObjectSearcher(querySound);
            foreach (ManagementObject sound in searcherSound.Get())
            {
                Console.WriteLine("Sound device: {0}", sound["Name"]);
            }

            SelectQuery queryVideo = new SelectQuery("Win32_VideoController");
            ManagementObjectSearcher searchVideo = new ManagementObjectSearcher(queryVideo);
            foreach (ManagementObject video in searchVideo.Get())
            {
                Console.WriteLine("Video device: {0}", video["Name"]);
            }

            Console.ReadLine();
        }
    }
}

WMI .NET Overview

After posting noticed it wasn't marked .NET, however this could be of interest as well. Creating a WMI Application Using C++

Upvotes: 4

Geoff
Geoff

Reputation: 8850

I think your best bet is the DirectSound API, documented here: http://msdn.microsoft.com/en-us/library/bb219833%28VS.85%29.aspx

Specifically, the DirectSoundEnumerate call.

Upvotes: 0

Related Questions