I've been developing a color customization program recently and found how desk.cpl used to apply the HKCU\Control Panel\Colors
changes immediately.
How can I do this myself (in any langauge)? I don't want to use Windows API SetSysColors
function because I'm primary coding this program in Python. Any way I can do this?
Remarks
desk.cpl
actually changes the registry (but I'm not sure how)SetSysColors
function emits a WM_SYSCOLORCHANGE
message.I have tried
WM_SYSCOLORCHANGE
to all components using BroadcastSystemMessage
desk.cpl
behavior as much as possible to find all that is doesSetSysColors
is the only way, it calls into the kernel.
According to this mailing list post, the ctypes code looks like this:
from ctypes.wintypes import windll, c_int, byref, RGB
COLOR_BACKGROUND = 1 # from winuser.h or win32con
SetSysColors = windll.user32.SetSysColors
which_color = RGB(255,0,0) # red
SetSysColors(1, byref(c_int(COLOR_BACKGROUND)), byref(c_int(which_color)))