我正在使用desktop duplication api获取屏幕内容,结果显示,新的night light mode(德语中的'Nachtmodus')未应用于抓取的屏幕内容。
如何阅读(如果可能,直接在c#中)夜间模式状态(启用,色移量)?
或
如何告诉Windows使用桌面复制api为我提供换色图像?
基本上,我想知道这些红色框内配置的状态:
背景:我正在使用ambilight implementation并且如果启用了夜间照明模式,则颜色偏移不会反映在屏幕周围的LED中,因此屏幕内容和“屏幕周围”之间的颜色会消失
答案 0 :(得分:1)
此方法适用于 Windows 10 Version 2004
private static bool IsNightLightEnabled()
{
const string BlueLightReductionStateKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\CloudStore\Store\DefaultAccount\Current\default$windows.data.bluelightreduction.bluelightreductionstate\windows.data.bluelightreduction.bluelightreductionstate";
using (var key = Registry.CurrentUser.OpenSubKey(BlueLightReductionStateKey))
{
var data = key?.GetValue("Data");
if (data is null)
return false;
var byteData = (byte[])data;
return byteData.Length > 24 && byteData[23] == 0x10 && byteData[24] == 0x00;
}
}
答案 1 :(得分:0)
您可以查看
的输出<VirtualHost *:80>
Win API的功能。将输出与夜灯开启和关闭进行比较,您应该检测它。
或者您可以尝试监控此Reg键以进行更改
GetDeviceGammaRamp
答案 2 :(得分:0)
您应该监视另一个Reg键以进行更改
{-# OPTIONS_GHC -Wall #-}
module Lottery where
import Test.QuickCheck
type Animal = String
data Ticket = Ticket [Animal] Int
pticket :: Ticket -> String
pticket (Ticket ts prz) = unwords ts ++ ' ':show prz
tickets :: Gen [Ticket]
tickets = vectorOf 6 (oneof [winner, loser])
where winner = Ticket <$> (replicate 3 <$> animal) <*> prize
loser = Ticket <$> (vectorOf 3 animal) <*> prize
animal = elements ["tiger","rabbit","dragon","snake","rat","ox",
"pig","sheep","horse","monkey","dog"]
prize = choose (10,1000)
main :: IO ()
main = print . map pticket =<< generate tickets
答案 3 :(得分:0)
我想我找到了反映当前夜灯状态的注册表项。
[HKEY_CURRENT_USER\Control Panel\Quick Actions\Control Center\QuickActionsStateCapture]
"Toggles"="Toggles,...,Microsoft.QuickAction.BlueLightReduction:true,..."
尽管它不是很可靠,因为我认为它要求该特定的拨动开关应该可见...