DirectX game not using Nvidia GPU

[System.Runtime.InteropServices.DllImport("nvapi64.dll", EntryPoint = "fake")]
private static extern int LoadNvApi64();

[System.Runtime.InteropServices.DllImport("nvapi.dll", EntryPoint = "fake")]
private static extern int LoadNvApi32();

void TryForceHighPerformanceGpu()
{
    try
    {
        if (System.Environment.Is64BitProcess)
            LoadNvApi64();
        else
            LoadNvApi32();
    }
    catch { } // this will always be triggered, so just catch it and do nothing :P
}

Put this in Program.cs (or whatever you’ve renamed it to) and run at the start of Main()

5 Likes