procedure UpdateAlphaWindow(Wnd: HWND; Image: TGraphic; Canvas: TCanvas; Opacity: Byte = $FF); var Blend: TBlendFunction; Rect: TRect; P1, P2: TPoint; S: TSize; DC: HDC; begin if Image.Height = 0 then Exit; SetWindowLong(Wnd, GWL_EXSTYLE, GetWindowLong(Wnd, GWL_EXSTYLE) or WS_EX_LAYERED); GetWindowRect(Wnd, Rect); P1.X := Rect.Left; P1.Y := Rect.Top; with Blend do begin BlendOp := AC_SRC_OVER; BlendFlags := 0; SourceConstantAlpha := Opacity; AlphaFormat := AC_SRC_ALPHA; end; DC := GetDC(0); P2 := Point(0, 0); S.cx := Image.Width; S.cy := Image.Height; UpdateLayeredWindow(Wnd, DC, @P1, @S, Canvas.Handle, @P2, 0, @Blend, ULW_ALPHA); ReleaseDC(0, DC); end;