I've created a program to automatically adjust the colour filter of the screen according to sunset and sunrise. I use the GetDeviceGammaRamp()
and SetDeviceGammaRamp()
methods taken from here to achieve this.
However, there is a problem. When the computer wakes up from sleep, or when a UAC message
pops up (e.g: from opening an installation exe file), then on my laptop, the screen colour returns to normal. All well and good if it's temporary, but the way it does this though seems non-standard, as afterwards, GetDeviceGammaRamp()
returns the same previous colour, not the shown new colour! Also if I use SetDeviceGammaRamp()
to try and set the old colour back again, it refuses to set. However, if I use SetDeviceGammaRamp()
to change the RGB
colour even just SLIGHTLY (e.g: RGB = 80,80,81
instead of the old 80,80,80
), then Windows will happily set the colour to that.
If only I had a fool-proof way of detecting when Windows changes the screen's colour like this. Or failing that, if only it would respond to changing the colour back to the old colour instead of thinking "but you're already at that RGB
colour, so why would you want to set it again!", when clearly it's not.
Unfortunately unless I find a solution, I have to force the program to flash to a very slightly different colour every minute or so (which many people including myself) can notice. This is in case a UAC
prompt or computer wake-up happens which changes the screen's colour.
By the way, the famous F.lux
program hasn't solved the problem as their program has the issue too. Interestingly, my desktop keeps the same colour when a UAC
prompt comes up - it's just my laptop which has the issue.