I'd like to use the functionality of System.Windows.Forms.Application.AddMessageFilter but my target application does not use Windows Forms. This functionality adds a filter to monitor Windows messages as they are routed. If anyone knows how this works, I wouldn't mind writing my own code to perform the same function.
SetWindowLong with GWL_WNDPROC only affects received messages and I'd like to affect sent messages. System.Windows.Forms.Application is static but calling AddMessageFilter with an IMessageFilter that throws an exception does not work.