SetWindowLong()
operates on 32-bit LONG
integers, so it is suitable only for 32bit builds, not for 64bit builds, when using options that deal with pointers (GWL_HINSTANCE
, GWL_USERDATA
, GWL_WNDPROC
, DWL_DLGPROC
, DWL_USER
).
This is stated in the SetWindowLong()
documentation:
Note This function has been superseded by the SetWindowLongPtr function. To write code that is compatible with both 32-bit and 64-bit versions of Windows, use the SetWindowLongPtr function.
SetWindowLongPtr()
works with pointer-sized LONG_PTR
integers, so it is suitable for both 32bit and 64bit builds.
This is stated in the SetWindowLongPtr()
documentation:
Note To write code that is compatible with both 32-bit and 64-bit versions of Windows, use SetWindowLongPtr. When compiling for 32-bit Windows, SetWindowLongPtr is defined as a call to the SetWindowLong function.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…