I think this could be done using the WIN32 API, but the code to do it would likely be more lengthy, complex and crash-prone than the whole of the rest of your application.
If you want to pursue it, look into the SetWindowsHookEx function for starters. We can probably answer any questions you might have along the way and maybe even help with a little code. Be forwarned though, this is just a theory. I haven't tried it in the real world, and you could potentially invest a lot of time in a solution only to find that it really isn't feasible.