Use NVAPI C# To Set Preferred Graphics Processor

Hi I have searched for over 80+hrs online and have 0 clue on what apis calls I need to change the NVIDIA Control Panel Option → 3d Settings → Preferred Graphics processor. What Code Do I use for C# on windows 10 programmatically?

Since nobody would reply here is my solution I created.

  • The Program is compiled on X86 which works for 32 bit, 64 bit, arm64
  • Without Args Enables High Performance Graphics Processor and with args can set individual settings assuming you know the DWORD Setting ID and DWORD Value
  • It’s scriptable and outputs the last values it had before applying them
  • Source Code is included (41.9 KB)