I made a global keyboard hook which according to MSDN needs to be in a separate DLL and it works fine. Now when a user does a certain keypress I want the DLL to report that back to the application loading it who does all the job. I pass the HWND of the application to the DLL in an initialization procedure and then try to SendMessage and PostMessage to it with a (WM_USER + offset) message, but the message is never received by the application. Since the DLL resides in the same thread it should be no issue. I also tried sending the message to the thread itself (NULL HWND) and that didn't work out either.

How can I communicate with the caller?