Einzelnen Beitrag anzeigen

samso

Registriert seit: 29. Mär 2009
439 Beiträge
 
#8

AW: Problem mit CreateParams und WS_EX_APPWINDOW

  Alt 24. Dez 2017, 10:05
Ich sehe gerade, bei meinem Delphi 2007 habe ich 2014 die Controls.pas modifiziert. (Irgendwie kam mir die Fehlerbeschreibung bekannt vor). Allerdings ist meine Fehlerbeschreibung etwas anders. Bei mir scheint der Fehler nur aufgetreten zu sein, wenn ich in Form2 einen Hint angezeigen lies.

Delphi-Quellcode:
procedure THintWindow.ActivateHint(Rect: TRect; const AHint: string);
type
  TAnimationStyle = (atSlideNeg, atSlidePos, atBlend);
const
  AnimationStyle: array[TAnimationStyle] of Integer = (AW_VER_NEGATIVE,
    AW_VER_POSITIVE, AW_BLEND);
var
  Animate: BOOL;
  Style: TAnimationStyle;
  Monitor: TMonitor;
begin
  FActivating := True;
  try
    Caption := AHint;
    Inc(Rect.Bottom, 4);
    UpdateBoundsRect(Rect);
    Monitor := Screen.MonitorFromPoint(Point(Rect.Left, Rect.Top));
    if Width > Monitor.Width then
      Width := Monitor.Width;
    if Height > Monitor.Height then
      Height := Monitor.Height;
    if Rect.Top + Height > Monitor.Top + Monitor.Height then
      Rect.Top := (Monitor.Top + Monitor.Height) - Height;
    if Rect.Left + Width > Monitor.Left + Monitor.Width then
      Rect.Left := (Monitor.Left + Monitor.Width) - Width;
    if Rect.Left < Monitor.Left then Rect.Left := Monitor.Left;
    if Rect.Bottom < Monitor.Top then Rect.Bottom := Monitor.Top;

    SetWindowPos(Handle, HWND_TOPMOST, Rect.Left, Rect.Top, Width, Height,
      SWP_NOACTIVATE or SWP_NOOWNERZORDER); //15.3.2014 SWP_NOOWNERZORDER hinzugefügt **
    if (GetTickCount - FLastActive > 250) and (Length(AHint) < 100) and
       Assigned(AnimateWindowProc) then
    begin
      SystemParametersInfo(SPI_GETTOOLTIPANIMATION, 0, @Animate, 0);
      if Animate then
      begin
        SystemParametersInfo(SPI_GETTOOLTIPFADE, 0, @Animate, 0);
        if Animate then
          Style := atBlend
        else
          if Mouse.GetCursorPos.Y > Rect.Top then
            Style := atSlideNeg
          else
            Style := atSlidePos;
        AnimateWindowProc(Handle, 100, AnimationStyle[Style] or AW_SLIDE);
      end;
    end;
    ParentWindow := Application.Handle;
    ShowWindow(Handle, SW_SHOWNOACTIVATE);
    Invalidate;
  finally
    FLastActive := GetTickCount;
    FActivating := False;
  end;
  // ** Bugfix für Fenster mit ExStyle = WS_EX_APPWINDOW. Dort wurde das Hauptfenster
  // nach vorne geholt, wenn das untergeordnete Fenster einen Hint anzeigte
end;
  Mit Zitat antworten Zitat