Unable to load NVCPL.dll when using NV Control Panel API

So I am trying to make an automated program in which the display resolution is changed using NV Control Panel API but all I get is an error stating;

“Unable to load NVCPL.dll”

The Nvidia Control Panel works perfectly and I can access it without any problems.