![]() |
WindowFromPoint löst Exception aus bei Strg+Alt+Entf
Hallo,
ich nutze WindowFromPoint in einem Timer um zu prüfen, ob die Maus über einem bestimmten Element schwebt, da dieses kein OnExit Ereignis hat. Das funktioniert auch sehr gut, bis Strg+Alt+Entf gedrückt wird. Dann kommt eine Exception Zitat:
Zitat:
Ganz leicht kann man das mit folgendem Codeschnipsel nachbauen
Delphi-Quellcode:
Fällt euch vielleicht ein, wie man die Exception umgehen kann?
procedure TForm1.Timer1Timer(Sender: TObject);
begin Label1.Caption := IntToStr(WindowFromPoint(Mouse.CursorPos)); end; Gruß Philip |
Re: WindowFromPoint löst Exception aus bei Strg+Alt+Entf
Zitat:
Delphi-Quellcode:
Nicht nur Strg+Alt+Entf ist ein Fall das Windows.GetCursorPos False zurückliefert sondern auch der Remote Deskotp mit schließen der Fernsteuerung ohne abmelden.
Windows.GetCursorPos(result)
|
Re: WindowFromPoint löst Exception aus bei Strg+Alt+Entf
Ich würde in diesem Fall einen Low Level Mousehook verwenden und somit das verwenden eines Timers
umgehen. |
Re: WindowFromPoint löst Exception aus bei Strg+Alt+Entf
Ja, danke!
Bin gar nicht darauf gekommen, dass das Problem bei "Mouse.CursorPos" liegt, weil der Ausdruck so harmlos aussieht. :roll:
Delphi-Quellcode:
Jetzt klappts
procedure TForm1.Timer1Timer(Sender: TObject);
var Mousepos: TPoint; begin Windows.GetCursorPos(Mousepos); Label1.Caption := IntToStr(WindowFromPoint(Mousepos)); end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:27 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz