What is a message?

Source: Internet
Author: User
Windows message-based mode: once Program Start, it simply waits for the message sent to it, and then responds accordingly. Windows checks whether a key is pressed or the mouse is moved. When such an event occurs, Windows sends a predefined message to the program to tell it what has been generated. Programs generally have options to respond to or ignore messages.
· Dos process mode: C ++ Code It is usually linear execution, that is, from the beginning to the end of the program, each time a line of code is executed, or transferred to a line of code, or loop execution, in these ways to run the code segment. To know what happened, the program must call an interrupted-based sub-program. These subroutines are built inside the operating system or implemented by hardware. When a subroutine is returned, the report shows whether a key is pressed or the mouse is moved.

The message is actually a constant defined in the windows. h file complex. It should not be surprising now. As an example, the following message about keyboard processing and mouse movement is displayed:

// keyboard messages
# define wm_keydown 0x0100 // key was pressed
# define wm_keyup 0x0101 // key was released
# define wm_char 0x0102 // processed keystroke
# define wm_deadchar 0x0103 // composite key
# define wm_syskeydown 0x0104 // Alt key was pressed
# define wm_syskeyup 0x0105 // Alt key was released
# define wm_syschar 0x0106 // processed system keystroke
# define wm_sysdeadchar 0x0107/composite system keystroke

// Mouse input messages
# Define wm_mousemove 0x0200 // mouse was moved
# Define wm_lbuttondown 0x0201 // left button pressed
# Define wm_lbuttonup 0x0202 // left button released
# Define wm_lbuttondblclk 0x0203 // double click of left button
# Define wm_rbuttondown 0x0204 // right button pressed
# Define wm_rbuttonup 0x0205 // right button released
# Define wm_rbuttondblclk 0x0206 // double click of right button
# Define wm_mbuttondown 0x0207 // middle button down
# Define wm_mbuttonup 0x0208 // middle button up
# Define wm_mbuttondblclk 0x0209 // double click of middle button

Do not try to remember these messages. Just take a rough look and get familiar with their appearance and service types.
Obviously, there is nothing mysterious about the message itself. They are just simple constants with useful names to notify the current state of the Program System. When an event occurs, these messages are bundled with other useful information and sent to one or more application window processes.

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.