You should absolutely not use Long instead of LongPtr. Where did the type mismatch occur?

The whole point of conditional compilation is to make the code run on any system.