64-bit Windows API: what is the size of a C/C++ "DWORD"?

Stéphane picture Stéphane · Feb 14, 2011 · Viewed 9k times · Source

I only have 32-bit Windows installed, so I cannot verify this myself.

If I understand correctly, the DWORD used in various places in the Microsoft API is in reference to the original 16-bit word, and has nothing to do with the current hardware architecture?

So DWORD which seems to be 32 bits, will remain 32 bits even when I eventually compile and link my app to run in 64-bit Windows? Or will DWORD become 128 bits wide?

Answer

David Heffernan picture David Heffernan · Feb 14, 2011

The only thing that changes size between 32 and 64 are pointers. So DWORD stays 32 bits wide.

Some things are not immediately obviously pointers, e.g. HANDLE, LPARAM, WPARAM. But these three change width as they actually hold pointers.