I have some trouble understanding one particular thing. My computer is running 64-bit Windows, and so
std::cout << sizeof(HANDLE) << std::endl;
std::cout << sizeof(HWND) << std::endl;
std::cout << sizeof(int*) << std::endl;
all prints 8, i.e. 8 bytes (64 bits).
Now, in the Window Procedure
LRESULT __stdcall wndProc(HWND, UINT, WPARAM, LPARAM lParam)
the sizes (in bytes) of WPARAM and LPARAM are also 8. I recall reading in Petzold's book, however, that there are some messages for which a handle to a window is stored in either the LOWORD or the HIWORD of the LPARAM argument. For example,
HWND childHandle = (HWND)LOWORD(lParam);
How can this be? The HIWORD of lParam, is the top two bytes of a 32-bit integer? In order to store a handle in an LPARAM, would that require all eight bytes?
Thanks!