I am trying to redo some of my old projects to support Aero Glass. Although it’s easy to turn on the glass frame, I ran into some serious problems. I used this code:
var
xVer: TOSVersionInfo;
hDWM: THandle;
DwmIsCompositionEnabled: function(pbEnabled: BOOL): HRESULT; stdcall;
DwmExtendFrameIntoClientArea: function(hWnd: HWND; const pxMarInset: PRect): HRESULT; stdcall;
bEnabled: BOOL;
xFrame: TRect;
// ...
xVer.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
GetVersionEx(xVer);
if xVer.dwMajorVersion >= 6 then
begin
hDWM := LoadLibrary('dwmapi.dll');
@DwmIsCompositionEnabled := GetProcAddress(hDWM, 'DwmIsCompositionEnabled');
@DwmExtendFrameIntoClientArea := GetProcAddress(hDWM, 'DwmExtendFrameIntoClientArea');
if (@DwmIsCompositionEnabled <> nil) and
(@DwmExtendFrameIntoClientArea <> nil) then
begin
DwmIsCompositionEnabled(@bEnabled);
if bEnabled then
begin
xRect := Rect(-1, -1, -1, -1);
DwmExtendFrameIntoClientArea(FrmMain.Handle, @xRect);
end;
end;
FreeLibrary(hDWM);
end;
So, I got a beautiful glass. Due to the fact that black has become a transparent color (just a stupid choice why it could not be pink), everything that is clBlack becomes transparent. This means that all labels, edits, button texts ... even if I set the text to a different color during development, DWM still makes them the same color and transparent.
Well, my question will be: can this be somehow solved?
source
share