AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Problem mit CreateParams und WS_EX_APPWINDOW
Thema durchsuchen
Ansicht
Themen-Optionen

Problem mit CreateParams und WS_EX_APPWINDOW

Ein Thema von iphi · begonnen am 23. Dez 2017 · letzter Beitrag vom 24. Dez 2017
Antwort Antwort
Seite 2 von 2     12   
samso

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

AW: Problem mit CreateParams und WS_EX_APPWINDOW

  Alt 24. Dez 2017, 10:27
Spätestens bei Delphi 2010 wurde der Fehler möglicherweise von Seiten Embarcadero beseitigt. Die eigentliche Fehlerursache scheint darin zu liegen, dass das ParentWindow für das HintWindow nicht rechtzeitig gesetzt wurde.

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.Top := Monitor.Top;

    ParentWindow := Application.Handle; // <<<<<<<<<<<<<<
    SetWindowPos(Handle, HWND_TOPMOST, Rect.Left, Rect.Top, Width, Height,
      SWP_NOACTIVATE);
    if (GetTickCount - FLastActive > 250) and (Length(AHint) < 100) and
       Assigned(AnimateWindowProc) then
    begin
      SystemParametersInfo(SPI_GETTOOLTIPANIMATION, 0, {$IFNDEF CLR}@{$ENDIF}Animate, 0);
      if Animate then
      begin
        SystemParametersInfo(SPI_GETTOOLTIPFADE, 0, {$IFNDEF CLR}@{$ENDIF}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;
    ShowWindow(Handle, SW_SHOWNOACTIVATE);
    Invalidate;
  finally
    FLastActive := GetTickCount;
    FActivating := False;
  end;
end;
Man beachte die geänderte Position der Zuweisung "ParentWindow := Application.Handle" (im Vergleich zu der Version von Delphi 2007)

Geändert von samso (24. Dez 2017 um 10:29 Uhr)
  Mit Zitat antworten Zitat
iphi

Registriert seit: 13. Feb 2009
262 Beiträge
 
Delphi 7 Personal
 
#12

AW: Problem mit CreateParams und WS_EX_APPWINDOW

  Alt 24. Dez 2017, 12:18
Zitat:
Delphi-Quellcode:
SetWindowPos(Handle, HWND_TOPMOST, Rect.Left, Rect.Top, Width, Height,
      SWP_NOACTIVATE or SWP_NOOWNERZORDER); //15.3.2014 SWP_NOOWNERZORDER hinzugefügt **
Super, danke Samso, das wars. Der Fix funktioniert auch unter Delphi7!

Frohes Fest an alle!
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 2 von 2     12   

 

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:53 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz