function WndProc(WinHandle: HWND; Msg: UINT; wP: WParam; lP: LParam): longint;
stdcall;
var
ps: TPaintStruct;
rw: PRect;
hBut: THandle;
imgW: cardinal;
pMM: PMinMaxInfo;
CaptionHeight: integer;
p: TPoint;
begin
with SkinEngine
do
begin
case Msg
of
WM_GETMINMAXINFO:
begin
pMM := PMinMaxInfo(lP);
pMM^.ptMinTrackSize.x := MinTrackSizeX[0];
pMM^.ptMinTrackSize.y := MinTrackSizeY[0];
end;
WM_COMMAND:
begin
if ButtonSysCommand(WinHandle, wP)
then
begin
Result := 0;
Exit;
end;
case LoWord(wP)
of
ID_AEROCRYSTAL:
begin
if GetCheckButtonStatus(GetMainItem(ID_AEROCRYSTAL))
then
begin
SplitColorARGB(SK_AEROCOLOR, Alpha, Red, Green, Blue);
FConfig.AeroColor[ColorARGB(GetTrackValue(GetMainItem(
ID_TRACK_OPACITY)),
RGB(Red, Green, Blue)), SK_WRITE];
SetCheckButtonStatus(GetMainItem(ID_AERODISABLE), False);
SetCheckButtonStatus(GetMainItem(ID_AEROBLUR), False);
FConfig.AeroEmulate[SK_WRITE, SK_WRITE];
FConfig.AeroBlueLevel[SK_FALSE, SK_WRITE];
SetTrackValue(GetMainItem(ID_TRACK_BLURLEVEL), SK_AEROBLURLEVEL);
SetTimer(WinHandle, AERO_TIMER, SK_AEROTIMERDELAY,
nil);
FConfig.UseVistaBlur[SK_FALSE, SK_WRITE];
FConfig.UseVistaCrystal[SK_WRITE, SK_WRITE];
FConfig.TextRendering[TextRenderingHintAntiAlias, 1];
end else
begin
FConfig.TextRendering[TextRenderingDefault, 1];
KillTimer(WinHandle, AERO_TIMER);
FConfig.AeroEmulate[SK_FALSE, SK_WRITE];
SetCheckButtonStatus(GetMainItem(ID_AERODISABLE), True);
FConfig.UseVistaBlur[SK_FALSE, SK_WRITE];
FConfig.UseVistaCrystal[SK_FALSE, SK_WRITE];
end;
GetWindowRect(WinHandle, rc);
MoveBackground(rc.Left, rc.Top);
FUpdateWindow(WinHandle, False);
end;
ID_AEROBLUR:
begin
if GetCheckButtonStatus(GetMainItem(ID_AEROBLUR))
then
begin
SplitColorARGB(SK_AEROCOLOR, Alpha, Red, Green, Blue);
FConfig.AeroColor[ColorARGB(GetTrackValue(GetMainItem(
ID_TRACK_OPACITY)),
RGB(Red, Green, Blue)), SK_WRITE];
SetCheckButtonStatus(GetMainItem(ID_AERODISABLE), False);
SetCheckButtonStatus(GetMainItem(ID_AEROCRYSTAL), False);
FConfig.AeroEmulate[SK_WRITE, SK_WRITE];
FConfig.AeroBlueLevel[6, SK_WRITE];
SetTrackValue(GetMainItem(ID_TRACK_BLURLEVEL), SK_AEROBLURLEVEL);
SetTimer(WinHandle, AERO_TIMER, SK_AEROTIMERDELAY,
nil);
FConfig.UseVistaCrystal[SK_FALSE, SK_WRITE];
FConfig.UseVistaBlur[SK_WRITE, SK_WRITE];
FConfig.TextRendering[TextRenderingHintAntiAlias, 1];
end else
begin
FConfig.TextRendering[TextRenderingDefault, 1];
KillTimer(WinHandle, AERO_TIMER);
FConfig.AeroEmulate[SK_FALSE, SK_WRITE];
SetCheckButtonStatus(GetMainItem(ID_AERODISABLE), True);
FConfig.UseVistaBlur[SK_FALSE, SK_WRITE];
FConfig.UseVistaCrystal[SK_FALSE, SK_WRITE];
end;
GetWindowRect(WinHandle, rc);
MoveBackground(rc.Left, rc.Top);
FUpdateWindow(WinHandle, False);
end;
ID_AERODISABLE:
begin
if GetCheckButtonStatus(GetMainItem(ID_AERODISABLE))
then
begin
SetCheckButtonStatus(GetMainItem(ID_AEROBLUR), False);
SetCheckButtonStatus(GetMainItem(ID_AEROCRYSTAL), False);
FConfig.AeroEmulate[SK_FALSE, SK_WRITE];
FConfig.TextRendering[TextRenderingDefault, 1];
KillTimer(WinHandle, AERO_TIMER);
FConfig.UseVistaBlur[SK_FALSE, SK_WRITE];
FConfig.UseVistaCrystal[SK_FALSE, SK_WRITE];
GetWindowRect(WinHandle, rc);
MoveBackground(rc.Left, rc.Top);
FUpdateWindow(WinHandle, False);
end else
SetCheckButtonStatus(GetMainItem(ID_AERODISABLE), True);
end;
ID_TRACK_OPACITY:
begin
if SK_AEROEMULATE <> 0
then
begin
SplitColorARGB(SK_AEROCOLOR, Alpha, Red, Green, Blue);
FConfig.AeroColor[ColorARGB(lP,
RGB(Red, Green, Blue)), SK_WRITE];
GetWindowRect(WinHandle, rc);
MoveBackground(rc.Left, rc.Top);
FUpdateWindow(WinHandle, False);
end;
end;
ID_TRACK_BLURLEVEL:
begin
if lP <> SK_AEROBLURLEVEL
then
begin
FConfig.AeroBlueLevel[lP, SK_WRITE];
if SK_AEROEMULATE = 1
then
begin
GetWindowRect(WinHandle, rc);
MoveBackground(rc.Left, rc.Top);
FUpdateWindow(WinHandle, False);
end;
end;
end else
begin
Result := 0;
exit;
end;
end;
end;
WM_SIZE:
begin
DrawBackground;
EnumChildWindows(WinHandle, @AnchorEnum, 0);
FUpdateWindow(WinHandle, False);
end;
WM_SETTEXT:
begin
Result := DefWindowProc(WinHandle, Msg, wP, lP);
// Aktualisiere das Caption
PaintBackground;
// Nur Caption neuzeichnen
GetClientRect(WinHandle, rc);
GetImageSize(GetProperty(WinHandle, FORM_TopMid),
imgW, cardinal(rc.Bottom));
InvalidateRect(WinHandle, @rc, False);
UpdateWindow(WinHandle);
exit;
end;
WM_NCLBUTTONDBLCLK:
begin
if IsIconic(WinHandle)
then
begin
p.X := LoWord(lP);
p.Y := HiWord(lP);
ScreenToClient(WinHandle, p);
GetImageSize(GetProperty(WinHandle, FORM_TopMid),
imgW, cardinal(CaptionHeight));
if p.Y < CaptionHeight
then
begin
if IsZoomed(WinHandle)
then
ButtonSysCommand(WinHandle, MAKELONG(ID_RESTORE, 0))
else
ButtonSysCommand(WinHandle, MAKELONG(ID_MAXIMIZE, 0));
Result := 0;
exit;
end;
end;
end;
WM_NCACTIVATE:
begin
hBut := GetDlgItem(WinHandle, ID_LED);
if hBut <> 0
then
begin
Result := DefWindowProc(WinHandle, Msg, wP, lP);
if MainWindow(0) = GetForegroundWindow
then
gColorCaption := SK_ACTIVECAPTION
else
gColorCaption := SK_INACTIVECAPTION;
// Aktualisiere das Caption
PaintBackground;
// Nur Caption neuzeichnen
GetClientRect(WinHandle, rc);
GetImageSize(GetProperty(WinHandle, FORM_TopMid),
imgW, cardinal(rc.Bottom));
InvalidateRect(WinHandle, @rc, False);
UpdateWindow(WinHandle);
exit;
end;
end;
WM_ERASEBKGND:
begin
Result := 1;
exit;
end;
WM_PAINT:
begin
BeginPaint(WinHandle, ps);
PaintDoubleBuffer(WinHandle, ps.hdc);
EndPaint(WinHandle, ps);
Result := 0;
exit;
end;
WM_DESTROY:
begin
RemoveAllImageResource;
DestroyWindowResource(WinHandle);
PostQuitMessage(0);
Result := 0;
Exit;
end;
WM_TIMER:
begin
if IsCompositionEnabled = False
then
begin
if (SK_AEROEMULATE = 1)
and IsAeroLayered
then
begin
if IsLButtonDown = False
then
IsMoving := False;
if (IsMoving = False)
or (IsLButtonDown
and (IsMoving))
then
begin
GetWindowRect(WinHandle, rc);
MoveBackground(rc.Left, rc.Top);
FUpdateWindow(WinHandle, False);
end;
end;
end;
end;
WM_NCLBUTTONDOWN:
IsMoving := True;
WM_MOVING:
begin
if IsCompositionEnabled = False
then
begin
if (SK_AEROEMULATE = 1)
and IsAeroLayered
then
begin
rw := PRect(lP);
MoveBackground(rw.Left, rw.Top);
FUpdateWindow(WinHandle, False);
Result := 1;
exit;
end;
end;
end;
end;
Result := skDefWindowProc(WinHandle, Msg, wP, lP);
end;
end;