C# how to effectively detect which graphic card is used

Viewed 41

Following this post I had the need to detect which graphic card is really in use. In order to be sure to use the dedicated NVIDIA and not the integrated intel I:

  1. have set to use it for global usage

global usage

  1. have forced to use it for my application

my application

So I am pretty sure that my program is using the NVIDIA also because I see the GPU usage in the task manager




That being said I need a way to confirm that I am using the NVIDIA and not the INTEL graphic card.

From that page I see a way to do it. And following my implementation:

string strGraphicCards = "Graphic cards: ";
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_VideoController");
foreach (ManagementObject mo in searcher.Get())
{
    PropertyData currentBitsPerPixel = mo.Properties["CurrentBitsPerPixel"];
    PropertyData description = mo.Properties["Description"];
    if (currentBitsPerPixel != null && description != null)
    {
        if (mo["CurrentBitsPerPixel"] != null && mo["CurrentHorizontalResolution"] != null)
            strGraphicCards += " **USED** " + description.Value + ", ";
        else
            strGraphicCards += description.Value + ", ";
    }
}
Serializers.Loggers.WriteNLog(strGraphicCards, eLogLevel.Trace);

and quite unexpectedly the result is: enter image description here

Thanks for any help in understanding where the conundrum is

Patrick

0 Answers
Related