MFC中,(HIWORD(wParam)取得的无符号长整型参数的高16位是什么意思呢...

发布网友 发布时间:2024-10-23 10:04

我来回答

1个回答

热心网友 时间:7分钟前

请打开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.

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com