MFC中,(HIWORd(wParam)取得的无符号长整型参数的高16位是什么意思呢?
答案:1 悬赏:60 手机版
解决时间 2021-01-13 03:02
- 提问者网友:暗中人
- 2021-01-12 09:54
MFC中,(HIWORd(wParam)取得的无符号长整型参数的高16位是什么意思呢?
最佳答案
- 五星知识达人网友:底特律间谍
- 2021-01-12 10:17
请打开windef.h 查找WORD你将看到 如下的typedef定义别名
typedef unsigned short WORD;//WORD其实就是 unsigned short 无符号短整形,32位系统下它就是16位的
查找 LOWORD、HIWORD你将看到 如下的带参数宏定义
#define LOWORd(l) ((WORd)(l)) //就是个 类型强制转换
#define HIWORd(l) ((WORd)(((DWORd)(l) >> 16) & 0xFFFF)) // 就是把高位移到低位上
把高位刷成零,再来个类型强制转换
对应 EN_CHANGE 消息
The EN_CHANGE notification message is sent when the user has taken an
action that may have altered text in an edit control. Unlike the
EN_UPDATE notification message, this notification message is sent after
the system updates the screen. The parent window of the edit control receives
this notification message through a WM_COMMAND message.
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_COMMAND
WPARAM wParam, // edit control identifier, EN_CHANGE
LPARAM lParam // handle to edit control (HWND)
);
Parameters
wParam
The low-order word specifies the edit control identifier. 低字 (字、字节、双字你应该会的计算机基础)是控件ID
The high-order word specifies the notification message. 高字是通知代码
lParam
Handle to the edit control.
typedef unsigned short WORD;//WORD其实就是 unsigned short 无符号短整形,32位系统下它就是16位的
查找 LOWORD、HIWORD你将看到 如下的带参数宏定义
#define LOWORd(l) ((WORd)(l)) //就是个 类型强制转换
#define HIWORd(l) ((WORd)(((DWORd)(l) >> 16) & 0xFFFF)) // 就是把高位移到低位上
把高位刷成零,再来个类型强制转换
对应 EN_CHANGE 消息
The EN_CHANGE notification message is sent when the user has taken an
action that may have altered text in an edit control. Unlike the
EN_UPDATE notification message, this notification message is sent after
the system updates the screen. The parent window of the edit control receives
this notification message through a WM_COMMAND message.
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_COMMAND
WPARAM wParam, // edit control identifier, EN_CHANGE
LPARAM lParam // handle to edit control (HWND)
);
Parameters
wParam
The low-order word specifies the edit control identifier. 低字 (字、字节、双字你应该会的计算机基础)是控件ID
The high-order word specifies the notification message. 高字是通知代码
lParam
Handle to the edit control.
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯