AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein GUI-Design mit VCL / FireMonkey / Common Controls Click auf Taskbarbutton löst onDeactivate onActivate aus
Thema durchsuchen
Ansicht
Themen-Optionen

Click auf Taskbarbutton löst onDeactivate onActivate aus

Ein Thema von v2afrank · begonnen am 21. Nov 2022 · letzter Beitrag vom 22. Nov 2022
 
v2afrank

Registriert seit: 9. Mai 2005
Ort: Bocholt
576 Beiträge
 
Delphi XE2 Professional
 
#5

AW: Click auf Taskbarbutton löst onDeactivate onActivate aus

  Alt 22. Nov 2022, 08:10
Ich habe das Ganze noch einmal mit C# nachgebildet (das Gleiche Verhalten) und daraufhin hier folgendes gefunden
You should be using WM_SETFOCUS and WM_KILLFOCUS to determine if your window has the focus.

With regard to WM_ACTIVEATEAPP, both wParam (TRUE/FALSE) and lParam (thread id) are important to the interpretation of that message. Review the docs, which also state "The message is sent to the application whose window is being activated and to the application whose window is being deactivated." So, under certain circumstances, you can expect to receive two WM_ACTIVATEAPP messages - but only one applicable to your thread.

Under certain circumstances, WM_ACTIVATE may also be sent twice, but, similar to WM_ACTIVATEAPP, you must look at all applicable parameters, i.e., wParam AND lParam, to determine the applicability to your app. EDIT: wParam and lParam do NOT have the same meaning for those messages.

As an example, I was able to duplicate the situation by having both App1 and notepad open on the desktop. App1 has the focus. Following a click of the taskbar icon, App1 is minimized and receives:

[columns = message, wParam, lParam]

WM_ACTIVATEAPP False 6856 // window in thread 6856 deactivated. I.e., App1
WM_KILLFOCUS
WM_ACTIVATEAPP True 0 // window in thread 0 activated - I assume notepad. In any case, not applicable to App1??

EDIT: I think the docs are confused (or, at least, confusing). They state: wParam is TRUE if the window is being activated; FALSE if deactivated. That part appears correct.

However, for lParam, the docs say if wParam is TRUE, lParam is the thread that owns the window being deactivated; and if wParam is FALSE, lParam is the thread that owns the window being activated. It appears that the interpretation of lParam should be the thread owner. Period. Without regard to wParam.
  Mit Zitat antworten Zitat
 


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 04:47 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