Discussion:
dialog - detect if WM_xxx messages are from an external party
(too old to reply)
R.Wieser
2019-01-21 09:13:30 UTC
Permalink
Hello all,

I've got a dialog which should respond to some external WM_xxx messages. I
would however like to protect the internally-generated ones (callbacks and
so on by its children) from being confused as external ones (read: send them
to different handlers).

Question: How do I differ between the two groups of messages ?

A quick peek into User32 did not turn up anything, and neither did some
googeling (might be a case of not knowing what exactly to look for though
....)

Regards,
Rudy Wieser
JJ
2019-01-21 12:10:28 UTC
Permalink
Post by R.Wieser
Hello all,
I've got a dialog which should respond to some external WM_xxx messages. I
would however like to protect the internally-generated ones (callbacks and
so on by its children) from being confused as external ones (read: send them
to different handlers).
Question: How do I differ between the two groups of messages ?
A quick peek into User32 did not turn up anything, and neither did some
googeling (might be a case of not knowing what exactly to look for though
.....)
You might want to try using SetMessageExtrainfo() and GetMessageExtrainfo()
to "tag" internal messages. But on some window messages, it may get
overwritten by built in window message handlers.

If your code is the one who sent the internal messages, a message log may
help. When an internal message is about to be sent, put it into the log. The
receiver should lookup the log to see if the received message is logged.
R.Wieser
2019-01-21 13:57:33 UTC
Permalink
JJ,
Post by JJ
You might want to try using SetMessageExtrainfo() and
GetMessageExtrainfo()
I can certainly try the latter, but not the former. Even a simple listbox
generates callback messages in a way I cannot control.

... and reading the MSDN info to it it seems that they *have* to be used in
tandem (or having no clue to what gets returned :-( ).
Post by JJ
If your code is the one who sent the internal messages, a message
log may help. When an internal message is about to be sent, put it
into the log.
Same problem I'm afraid. Callback messages who's sending I do not control.
And trying to subclass *every* control upto that depth does not really seem
feasable.

Shucks, I was silently hoping for a GetMessageControlHandle or something
like it. :-)

Thanks for the suggestions though.

Regards,
Rudy Wieser
JJ
2019-01-22 05:37:13 UTC
Permalink
Post by R.Wieser
JJ,
Post by JJ
You might want to try using SetMessageExtrainfo() and
GetMessageExtrainfo()
I can certainly try the latter, but not the former. Even a simple listbox
generates callback messages in a way I cannot control.
.... and reading the MSDN info to it it seems that they *have* to be used in
tandem (or having no clue to what gets returned :-( ).
Post by JJ
If your code is the one who sent the internal messages, a message
log may help. When an internal message is about to be sent, put it
into the log.
Same problem I'm afraid. Callback messages who's sending I do not control.
And trying to subclass *every* control upto that depth does not really seem
feasable.
Shucks, I was silently hoping for a GetMessageControlHandle or something
like it. :-)
Thanks for the suggestions though.
Regards,
Rudy Wieser
Well in that case, I'd hook message sending/posting API functions for the
current process.

Loading...