In the Win32 API, SetWindowLong() and SetClassLong() functions allow you to attach 32-bit long values to windows and window classes. In 64-bit Windows, Microsoft preserves this behavior. However, since applications often attach pointers to windows, Microsoft also adds new API functions for setting and getting 64-bit pointer properties on windows. The following table shows the preserved 32-bit functions and their new 64-bit counterparts:
32-bit only | 32 and 64-bit compatible |
---|---|
DWORD GetClassLong(HWND, INT) | ULONG_PTR GetClassLongPtr(HWND, INT) |
LONG GetWindowLong(HWND, INT) | LONG_PTR GetWindowLongPtr(HWND, INT) |
DWORD SetClassLong(HWND, INT, LONG) | ULONG_PTR SetClassLongPtr(HWND, INT, LONG_PTR) |
LONG SetWindowLong(HWND, INT, LONG) | LONG_PTR SetWindowLongPtr(HWND, INT, LONG_PTR) |
See the Visual C++ Language Reference in the MSDN library for more information on these Windows API functions.
Autodesk provides a new header file, Ac64BitHelpers.h, that redefines these new Windows API functions to bypass certain 64-bit compatibility compiler warnings. You can include this header file in modules that call these functions if you want to avoid these warnings.
The Ac64BitHelpers.h file also contains general purpose utilities for smoothing out 64-bit porting issues. It includes another new Autodesk header file, ac_tcslen.h. This file redefines the Windows _tcslen() function to ensure that it returns a valid unsigned 32-bit integer value.