From e2c2ac07047f95857d3517caec35aa8b31ab6572 Mon Sep 17 00:00:00 2001 From: VincentWei Date: Fri, 2 Feb 2018 12:18:11 +0800 Subject: [PATCH] tune description of MSG_CHAR --- RELEASE-NOTES.md | 15 ++++++++++++++- include/window.h | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 89358396..f2b2c976 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -104,7 +104,7 @@ The main changes in structure and functions: ##### Message -As a result, the strcuture `MSG` and all message-related functions changed. +The strcuture `MSG` and all message-related functions changed. For example, the prototype of `SendMessage` changed from int SendMessage (HWND hWnd, int nMsg, WPARAM wParam, LPARAM lParam) @@ -113,6 +113,19 @@ to LRESULT SendMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) +_IMPORTANT NOTE_ + +For best portability, you should use `LOBYTE_WORD16` and `HIBYTE_WORD16` +to get the bytes of a character when you extract the bytes from `WPARAM` +parameter of a `MSG_CHAR` message: + + MSG_CHAR + WORD16 ch = (WORD16)wParam; + DWORD key_flags = (DWORD)lParam; + byte0 = LOBYTE_WORD16 (ch); + byte1 = HIBYTE_WORD16 (ch); + + ##### Window callback procedure Furthermore, the structure and functions to register window class, diff --git a/include/window.h b/include/window.h index c4f6b2f8..71842bcd 100644 --- a/include/window.h +++ b/include/window.h @@ -420,11 +420,11 @@ extern "C" { * * \code * MSG_CHAR - * int ch = (int)wParam; + * WORD16 ch = (WORD16)wParam; * DWORD key_flags = (DWORD)lParam; * \endcode * - * \param ch The ASCII code of the pressed key. + * \param ch The EUC code of the pressed key. * \param key_flags The shift key status when this message occurred. * * \note Please use \a LOBYTE_WORD16 and \a HIBYTE_WORD16 to get the bytes