You can't do this in VB alone. You need to put a SetWindowsHookEx in a C++ DLL. A VB DLL won't do, because it is ... <ahem> ... just different.

You can hook all mouse and keyboard movements/presses in VB, but not capture all WM messages.

To find more about SetWindowsHookEx, I have kindly provided a link here