The integral types WPARAM, LPARAM, and LRESULT are 32 bits wide on 32-bit systems and 64 bits wide on 64-bit systems. What happens when a 32-bit process sends a message to a 64-bit window or vice versa? There's really only one choice when converting a 64-bit value to a 32-bit value: Truncation. When a 64-bit process sends a message to a 32-bit window, the 64-bit WPARAM and LPARAM values are truncated to 32 bits. Similarly, when a 64-bit window returns an LRESULT back to a 32-bit sender, the value is truncated. But converting a 32-bit value to a 64-bit value introduces a choice: Do you zero-extend or sign-extend?The answer is obvious if you remember the history of WPARAM, LPARAM, and LRESULT, or if you just look at the header file. The WPARAM is zero-extended, while LPARAM and LRESULT are sign-extended.If you remember that WPARAM used to be a WORD and LPARAM and LRESULT used to be LONG, then this follows from the fact that WORD is an unsigned type (therefore zero-extended) and LONG is a signed type (therefore sign-extended). Read more: The old new thing
QR:
QR:
0 comments:
Post a Comment