I am new to nvapi. I am trying to set custom resolution, brightness and contrast for a monitor programmatically using nvapi.
I want to acheive this from windows service. The GraphicsManager application needs to read the settings from a file and set the resolution at bootup time.
I am able to change the resolution when i execute the GraphicsManager exe file.
But its not working if it is hosted as windows service. Because all the windows services will run in session0. The window serive will not be able to get or set the GPU informations.
It seems an application should be running Session1 then only it will have the display control.
Below is my new approach to set custom resolution from windows service:
Create a GraphicsManagerLoaderService and host as windows service. When this service started, it will launch the GraphicsManager application by creating a new process in the current user’s logon session.
So the GraphicsManager application will be running in Session1.
I have hosted the GraphicsManagerLoaderService service and restarted the machine. After bootup, the service is up and running. I have checked the log and most of the navapi methods are working fine. ie. NvAPI_Initialize, NvAPI_EnumPhysicalGPUs, NvAPI_EnumNvidiaDisplayHandle, NvAPI_Mosaic_EnumDisplayGrids,
NvAPI_Mosaic_SetDisplayGrids, NvAPI_GPU_GetScanoutConfigurationEx, NvAPI_GPU_SetScanoutCompositionParameter.
But its throwing an error(NVAPI_ERROR) while calling NvAPI_GPU_SetScanoutWarping() to do Warp.
Can someone please provide some suggestion to resolve the issue.