Updated error checking for SetWindowLongPtr()