I'm looking for a way to adjust the brightness of a display, which is connected via HDMI to a Dragonboard 410c with Windows IoT Core installed. I read that DCC/CI can control the brightness over HDMI, tested that already with an OpenSource tool called "Monitorian" on my Windows 10 machine, which does work. This tool is written in C# but relies on "DllImport", with which i absolutely have no experience. So the question is, is it possible, to control the brightness from my UWP code somehow?
Using Windows 10 IoT Core API Porting Tool for Monitorian
Parsing Users\Dev\Desktop\mon\Monitorian.exe
Unbehandelte Ausnahme: System.DllNotFoundException: Die DLL "SQLite.Interop.dll": Das angegebene Modul wurde nicht gefunden. (Ausnahme von HRESULT: 0x8007007E) kann nicht geladen werden.
bei System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(SQLiteConfigOpsEnum op)
bei System.Data.SQLite.SQLite3.StaticIsInitialized()
bei System.Data.SQLite.SQLiteLog.Initialize()
bei System.Data.SQLite.SQLiteConnection..ctor(String connectionString, Boolean parseViaFramework)
bei System.Data.SQLite.SQLiteConnection..ctor(String connectionString)
bei IoTAPIPortingTool.Program.ProcessLines(String[] lines, Boolean isUAP, String filename, StringBuilder outputBuilder) in C:\Users\Dev\Desktop\iot-utilities-master\IoTAPIPortingTool\Program.cs:Zeile 213.
bei IoTAPIPortingTool.Program.Main(String[] args) in C:\Users\Dev\Desktop\iot-utilities-master\IoTAPIPortingTool\Program.cs:Zeile 498.
Fork Monitorian project, it's in GitHub and already has P/Invoke you're looking for !
Check that out:
https://github.com/emoacht/Monitorian/search?q=dllimport
Brightness functions are readily available:
There should be little changes needed if any for you to re-use the Monitorian.Core project on your application as well.
And as others said, P/Invoke isn't that difficult plus now you have a pretty good example.
Caveat: not sure about the availability of these APIs under UWP however.
Edit:
No support under UWP:
https://learn.microsoft.com/en-us/windows/win32/api/highlevelmonitorconfigurationapi/nf-highlevelmonitorconfigurationapi-getmonitorbrightness
What about trying the other way around then?
Host WinRT XAML controls in desktop apps (XAML Islands)
Edit:
There isn't a list of what's Win32 supported under IoT but there's a tool instead:
Windows 10 IoT Core API Porting Tool
So give it a try and see what it says.