Chinaunix首页 | 论坛 | 博客
  • 博客访问: 525410
  • 博文数量: 158
  • 博客积分: 4015
  • 博客等级: 上校
  • 技术积分: 1711
  • 用 户 组: 普通用户
  • 注册时间: 2009-01-27 14:00
文章分类

全部博文(158)

文章存档

2010年(71)

2009年(87)

我的朋友

分类: WINDOWS

2010-01-06 20:17:44

这两个参数都是32位, WPARAM定义为UINT, LPARAM定义为LONG, 从字面上基本可以看出来的, 当然WPARAM可不是WORD呢, 这是16位WINDOWS遗留下来的坏点, 在不同的消息中这两个参数的意义会不同, 有时看多了, 就有糊涂之感, 不如总结下:(时常更新的)

WM_SIZE:
cxClient = LOWORD(LPARAM);
cyClient = HIWORD(LPARAM);
LPARAM
低16位代表客户窗口的宽度
高16位代表客户窗口的高度
WPARAM
没有特别的意义




case WM_VSCROLL, WM_HSCROLL:
switch(LOWORD(WPARAM)) {
case SB_LINEUP:
case SB_LINEDOWN:
.
.
.
case SB_THUMBTRACK:
case SB_THUMBPOSITION:
iVscrollPos = HIWORD(WPARAM);
}
WPARAM
低16位代表滚动条消息
高16位代表在SB_THUMBTRACK和SB_THUMBPOSITION下滚动条目前的位置
LPARAM
目前还没有特别的意义

}



WM_KEYDOWN
WPARAM:代表虚拟键,virtual-key code,

请参看:



WM_CHAR
wParam
    Specifies the character code of the key.
lParam
    Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table.

    0-15
        Specifies the repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.



WM_LBUTTON
WPARAM
Parameters

    wParam
        Indicates whether various virtual keys are down. This parameter can be one or more of the following values.

        MK_CONTROL
            The CTRL key is down.
        MK_LBUTTON
            The left mouse button is down.
        MK_MBUTTON
            The middle mouse button is down.
        MK_RBUTTON
            The right mouse button is down.
        MK_SHIFT
            The SHIFT key is down.
        MK_XBUTTON1
            Windows 2000/XP: The first X button is down.
        MK_XBUTTON2
            Windows 2000/XP: The second X button is down.

    lParam
        The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

        The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.






    WM_LBUTTONUP

        WPARAM wParam
        LPARAM lParam;
        

Parameters

    wParam
        Indicates whether various virtual keys are down. This parameter can be one or more of the following values.

        MK_CONTROL
            The CTRL key is down.
        MK_MBUTTON
            The middle mouse button is down.
        MK_RBUTTON
            The right mouse button is down.
        MK_SHIFT
            The SHIFT key is down.
        MK_XBUTTON1
            Windows 2000/XP: The first X button is down.
        MK_XBUTTON2
            Windows 2000/XP: The second X button is down.

    lParam
        The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

        The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.






    WM_MOUSEMOVE

        WPARAM wParam
        LPARAM lParam;
        

Parameters

    wParam
        Indicates whether various virtual keys are down. This parameter can be one or more of the following values.

        MK_CONTROL
            The CTRL key is down.
        MK_LBUTTON
            The left mouse button is down.
        MK_MBUTTON
            The middle mouse button is down.
        MK_RBUTTON
            The right mouse button is down.
        MK_SHIFT
            The SHIFT key is down.
        MK_XBUTTON1
            Windows 2000/XP: The first X button is down.
        MK_XBUTTON2
            Windows 2000/XP: The second X button is down.

    lParam
        The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

        The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area


阅读(3043) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~