My example was not clear. I did try using $wParam as the buffer size as that is what was returned by the message hook from Win32::GUI. That still caused the system to hang on the second pass. It was not until I created the reference to wParam that it worked.