Ok, so what is the correct way to use SetWindowLongPtr? Doing this:
SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (LONG_PTR)this);
works fine in x64, but gives the warning "warning C4244: 'argument' : conversion from 'LONG_PTR' to 'LONG', possible loss of data" in Win32.
So, I changed it to:
SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (LONG)(LONG_PTR)this);
Expecting LONG to be 64 bits in x64. Wrong.
It worked fine (surprisingly) till shutdown, when I got a couple of access violations (Which didn't crash the app, however), sue to the pointer getting truncated to 32 bits.
So, my fix was:
// Fucking Microsoft headers#ifdef _WIN64# define CAST_TYPE (LONG_PTR)#else# define CAST_TYPE (LONG)(LONG_PTR)#endif// Later on...SetWindowLongPtr(m_hWnd, GWLP_USERDATA, CAST_TYPE this);
Surely there's a nicer way?
On the plus side, x64 works fine now. Yaaaaaay [smile].