delphi - How to process only the newest message using an out-of-context hook -


in application use winevent hook focus changes system-wide. because there no timing problems, use out-of-context hook, if know slow. if there multiple events fired on after another, system queues them , gives them hook callback function in right order.

now process newest focus change. if there other messages in queue, want callback function stop , restart parameters of newest message. there way that?

when receive focus change, create asynchronous notification yourself, , cancel previous notification(s) may still pending.

you can use postmessage() , peekmessage(pm_remove) that. post custom message yourself, removing previous custom message(s) still in queue.

or, can use ttimer/settimer() (re)start timer on each focus change, , process last change when timer elapses.

either way, last notification processed once messages slow down.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -