Evyatar Elmaliah
Evyatar Elmaliah

Reputation: 624

"Catch" all messages that was sent via SendMessage method

I'm using SendMessage method (WinAPI) to pass messages between 4 applications.
I want to create another application, calling LogApplication, that using like a log application, meaning that any message was sent from application to application via SendMessage insert into a log file.
I can to "catch" all the messages that send even if the 4 applications isn't send the message to LogApplication? i can catch all the messages that sent via SendMessage method?
If so, how?
Thanks.

SendMessage: https://msdn.microsoft.com/en-us/library/windows/desktop/ms644950(v=vs.85).aspx

Upvotes: 1

Views: 541

Answers (1)

marcinj
marcinj

Reputation: 49976

This is what Hooks are for. You install it with the use of SetWindowsHookEx, WH_GETMESSAGE should be fine for you. You will find examples in those SO:

Global hook using WH_GETMESSAGE and WH_KEYBOARD

WH_GETMESSAGE global hook not working

Upvotes: 2

Related Questions