views:

517

answers:

3

Hello everyone,

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

A: 

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.

Geoff
+2  A: 

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++

Jeremy Wilde
A: 

Thank you for the replies! DirectSoundEnumerate is exactly what I need for the sound card information; is there by chance an analogue for video cards in the Direct Graphics library? I've looked through it a bit and can't seem to find any...

I can't find an online documentation article for it, but perhaps look for the part of DirectX called "DirectDraw" (low-level graphics hardware access). There is probably a function called "DirectDrawCreate" around that you could use.
stakx