Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 通过DCC/CI对HDMI进行亮度控制?_C#_Uwp_Win Universal App_Brightness_Windows Iot Core 10 - Fatal编程技术网

C# 通过DCC/CI对HDMI进行亮度控制?

C# 通过DCC/CI对HDMI进行亮度控制?,c#,uwp,win-universal-app,brightness,windows-iot-core-10,C#,Uwp,Win Universal App,Brightness,Windows Iot Core 10,我正在寻找一种调整显示器亮度的方法,显示器通过HDMI连接到安装了Windows IoT核心的Dragonboard 410c。我读到DCC/CI可以通过HDMI控制亮度,已经在我的Windows10机器上用一个名为“Monitorian”的开源工具进行了测试,它确实可以工作。这个工具是用C#编写的,但依赖于“DllImport”,我对它完全没有经验。所以问题是,有没有可能通过我的UWP代码来控制亮度 为Monitorian使用Windows 10物联网核心API移植工具 Parsing Use

我正在寻找一种调整显示器亮度的方法,显示器通过HDMI连接到安装了Windows IoT核心的Dragonboard 410c。我读到DCC/CI可以通过HDMI控制亮度,已经在我的Windows10机器上用一个名为“Monitorian”的开源工具进行了测试,它确实可以工作。这个工具是用C#编写的,但依赖于“DllImport”,我对它完全没有经验。所以问题是,有没有可能通过我的UWP代码来控制亮度

为Monitorian使用Windows 10物联网核心API移植工具

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项目,它在GitHub中,并且已经有了您正在寻找的p/Invoke

请查看:

可随时获得:

    [DllImport("Dxva2.dll", SetLastError = true)]
    [return: MarshalAs(UnmanagedType.Bool)]
    private static extern bool GetMonitorBrightness(
        SafePhysicalMonitorHandle hMonitor,
        out uint pdwMinimumBrightness,
        out uint pdwCurrentBrightness,
        out uint pdwMaximumBrightness);

    [DllImport("Dxva2.dll", SetLastError = true)]
    [return: MarshalAs(UnmanagedType.Bool)]
    private static extern bool SetMonitorBrightness(
        SafePhysicalMonitorHandle hMonitor,
        uint dwNewBrightness);
您也可以在应用程序上重新使用项目,如果需要的话,应该很少进行更改

正如其他人所说,p/Invoke并没有那么难,而且现在您有了一个非常好的示例

警告:不确定UWP下这些API的可用性

编辑:

UWP下无支持:

支持的最低客户端Windows Vista[仅限桌面应用程序]

那么换个方向试试怎么样

编辑:

IoT下没有支持Win32的列表,但有一个工具:

Windows 10 IoT Core仅支持各种早期版本Windows上可用的Win32和.NET API表面积的子集。此工具将扫描您的二进制文件,并为您提供这些二进制文件使用的不可用API的报告,并为可能的替换提供建议。这将有助于估算从端口到物联网核心的成本,同时也有助于您的发展


因此,请尝试一下,看看它说了些什么。

简短回答:否。扩展回答:不是直接的,您需要依赖本机函数才能访问此类低级函数,因此您需要使用本机互操作。除非你找到一个第三方库,为你做所有“讨厌的事情”,否则你将需要互操作。如果您决定尝试这样做,这可能会对您有所帮助:而且,学习互操作的工作原理总是一件好事;)谢谢你的回答。我用Monitorian的代码编写了一个测试应用程序,但似乎需要一些权限。我得到:抛出异常:BrightnessControlTest.exe Windows API中的“System.ComponentModel.Win32Exception”在更改亮度(0x5)时抛出错误:访问拒绝感谢以获取其他信息。问题是,我需要它在Dragonboard 410c上运行,因此Windows IoT核心是我当前的工作场所。我在主要问题中添加了monitorian的代码,可以在完整的Windows 10上的小型控制台应用程序中调整亮度。但当我为ARM编译它并将其部署到Dragonboard中时,它就不起作用了。调试似乎表明,第一个方法调用“EnumDisplayMonitors”在“User32.dll”中不存在。在我的Dragonboard/Windows IoT核心上,这个库也比完整的Windows 10上的库小…不知道如何帮助,也许你应该问其他问题,以最大限度地获得答案。