How to obtain high and low Windows messages

Source: Internet
Author: User

Long A = 123456789;
Take the high position. First, shift A to the right of 16 digits. Then, the high position is automatically filled with zero.
A >>= 16;
At this time, the value is zero. This value is used to store Y coordinates in the message.
For a low position, it is directly connected to 0xffff, that is
A & = 0 xFFFF;
Because the binary value of 0xffff is 1111111111111111, the low value of 0xffff is obtained. Because the high value of 0xffff is zero, it is automatically truncated.
This value is used to store the coordinates of X in the message.
Protected override void wndproc (ref message m)
{
Long H = (long) M. lparam;
Long L = (long) M. lparam;

If (M. MSG = 0x201)
{
H> = 16;

L & = 0 xFFFF;
String STR = "Y:" + H. tostring () + ", X:" + L. tostring ();
MessageBox. Show (STR );
}
Base. wndproc (ref m );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.