IMessageFilter not for controls or form

D

deciacco

IMessageFilter interface allows one to capture messages before they are
sent to a control or a form. Is there a way, perhaps by implementing
another interface, to capture all messages to an exe.

In other words, if I add a custom message filter implementing the
IMessageFilter interface to my notifyicon class, I can capture messages
when I display forms. If I add custom event handlers to the various
events in the SystemEvents class I can respond to system wide events
like session ending. I would like to be able to respond to any event my
exe might be sent, or "Filter" any message sent to it.

Thanks!
 
N

Nicholas Paldino [.NET/C# MVP]

I don't quite understand what you are trying to do, since the
IMessageFilter interface implementation will be called for EVERY windows
message that is passing through the app. There is no way to specify to get
messages for one specific control or another. It is a catch-all.
 
D

deciacco

I want to be able to catch any message sent to my notifyicon app.
In the tests that I did, it looked like the only times I would be able to catch messages was when a window was open. For example my notifyicon app has
a settings window that can be pulled up by clicking on settings in the context menu. If that window was up then I would get messages, but if the
window was hidden, then no messages.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top