Reputation: 355
I noticed Windows has made the non-client area of windows automatically the color of the theme - Windows Aero. This is a great idea I think, because it makes the theme consistent across programs and a generally nicer interface. As a devious individual, I aspire to subvert Microsoft's intention here and get a GUI happening that uses a color set by my program, not the operating system's setting.
Thoughts?
Upvotes: 3
Views: 788
Reputation: 13580
Yes, it is possible, but you need to use undocumented functions. That means your program may not run on future versions of Windows or even if service packs or other updates are released.
If you're willing to run the risk, this blog post has full details and reverse-engineered the functions and how to use them. It includes a screenshot of what you can achieve:
Basically, there are two functions you need: DwmGetColorizationParameters
and DwmSetColorizationParameters
. The structure you pass to them and the method prototypes are (in Delphi, but I'm sure you can translate to C++ if that's what you're using):
tagCOLORIZATIONPARAMS = record
clrColor : COLORREF; //ColorizationColor
clrAftGlow : COLORREF; //ColorizationAfterglow
nIntensity : UINT; //ColorizationColorBalance -> 0-100
clrAftGlowBal : UINT; //ColorizationAfterglowBalance
clrBlurBal : UINT; //ColorizationBlurBalance
clrGlassReflInt : UINT; //ColorizationGlassReflectionIntensity
fOpaque : BOOL;
end;
COLORIZATIONPARAMS=tagCOLORIZATIONPARAMS;
TColorizationParams=COLORIZATIONPARAMS;
PColorizationParams=^TColorizationParams;
TDwmGetColorizationParameters = procedure(out parameters :TColorizationParams); stdcall;
TDwmSetColorizationParameters = procedure(parameters :PColorizationParams; unknown:BOOL); stdcall;
If you're not used to that syntax, the top part defines a struct and the bottom two lines are method prototypes. ^ means a pointer, so the Set method is taking a pointer to the struct. out
is tricky and means that that method is taking a pointer to the structure too. procedure
means it returns void. If you still have trouble reading it then leave a comment and I'll translate to C.
You should be able to figure out everything you need from that, but if you want more details or an example of using it then read the blog post. (It's an excellent post and deserves the traffic.)
Upvotes: 6