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

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -