Fixes for Win64

fixed passing of payloads via window messages to work properly on both Win32 and Win64

slightly more efficient pointer casting