NvAPI_DISP_TryCustomDisplay works only after custom resolution added in Nvidia Control Panel

I see this problem has been asked before but the answers could not solve my problem.

I am trying to set a customer resolution/refresh rate using NvAPI_DISP_TryCustomDisplay. The call returns NVAPI_ERROR, unless I go to Nvidia Control Panel to add that custom resolution through the UI first.

My code was based on CustomTiming.cpp in the samples. I have tried different timing types, color format, and so on, but the only way it can work is if I add the resolution through the panel first. The display adapter I am using is a RTX A400 if that matters.

I am looking to see what other settings I can look into to solve this issue. Can anyone help with this? Thank you.

Dear @newon

Thank you for contacting NVIDIA developer forum.
Our technical team has received your query and we will reach out to you to get more details.

Thanks,
NVAPI Forum Moderator