3

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

Patrick
  • 3,073
  • 2
  • 22
  • 60
  • No, this is the post I have taken my code from. The result is not correct (see above) – Patrick Jun 14 '21 at 14:34
  • 1
    The query is different. You have linked another post in your question. (edit) I see, there is a second link. Please try with `Win32_DisplayConfiguration` – Sinatr Jun 14 '21 at 14:38
  • Woath thanks a lot! It works. Is that a general case solution? You might want to post is so that I can close the question – Patrick Jun 14 '21 at 14:51

0 Answers0