Message implementation of the Windows message processing mechanism

Updated on technology 2024-05-20
3 answers
  1. Anonymous users2024-02-11

    The messaging system of Windows is made up of 3 parts:

    Message queues. Windows is able to maintain a message queue for all applications. The application must be fetched from the message queue.

    message, and then assign it to a window.

    Message loops. Through this looping mechanism, the application retrieves the message from the message queue and dispatches it to the appropriate window.

    After that, the next message is retrieved from the message queue and then assigned to the appropriate window, and then in turn.

    Window process. Each window has a window process to receive the message delivered to the window, and its task is to get the message then.

    Respond to it. The window procedure is a ** function; After processing a message, it usually returns a value to Windows.

    Note that a function is a function in a program that is called by Windows or an external module.

    There are 5 steps to a message from the time it is generated to the time it is responded to by a window

    1) An event has occurred in the system.

    2) Windows translates the event into a message and puts it in the message queue.

    3) The application receives the message from the message queue and stores it in a TMSG record.

    4) The application passes the message to an appropriate window window by the window process.

    5) The window process responds to this message and processes it.

    Steps 3 and 4 make up the message loop of the application. Message loops tend to be at the heart of Windows applications because of message loops.

    Enables an application to respond to external events. The task of a message loop is to retrieve a message from a message queue and deliver it to the appropriate window. If there are no messages in the message queue, Windows allows other applications to process their messages.

    The biggest feature of the Windows operating system is its graphical operation interface, which is based on its message processing mechanism. If you don't understand Windows message processing, you won't be able to understand Windows programming in depth. Unfortunately, many programmers have only heard a little about Windows messages, and have little knowledge of their use, let alone their internal implementations.

    It can be said that mastering this part of the knowledge is to master the magic weapon in Windows programming, and using it flexibly will greatly improve our programming ability.

  2. Anonymous users2024-02-10

    The system will maintain one or more message queues, and all generated messages will be put into or inserted into the queue. The system fetches each message from the queue and sends it to the message loop of the program that owns the window, based on the handle to which the message is received. Each running program has its own message loop, in which it gets its own message and calls the corresponding window procedure according to the handle of the receiving window.

    And when there is no message, the message loop hands over control to the system, so Windows can do multiple tasks at the same time.

    In a 16-bit system, there is only one message queue in the system, so the system must wait for the current task to process the message before sending the next message to the corresponding program. This kind of multi-tasking system is also called a collaborative multitasking system. That's the kind of system.

    In a 32-bit system, there will be a message queue for each running program, so the system can switch between multiple message queues without waiting for the current program to finish processing the message. This kind of multi-tasking system is called a preemptive multitasking system. Windows95 NT 98 2000 XP32 is such a system.

  3. Anonymous users2024-02-09

    Standard Windows Messages, Control Messages, Command Messages.

Related questions
7 answers2024-05-20

Because antivirus software and firewalls are registered as system driver services, the main process belongs to the kernel process, which of course has a high priority. >>>More

16 answers2024-05-20

The latest launch - terracotta texture paint is widely used in villas, high-end communities. >>>More

20 answers2024-05-20

The CPU is the brain of a computer, and every computer must have it; Windows is just an operating system, there are many operating systems in the world, such as Linux, Mac, etc., there is no Windows that can work, but it is absolutely not possible without a CPU.

3 answers2024-05-20

1) Whether to enable the permission setting of the notification bar. 2) You need to turn on the background operation of easyMarkets (different mobile phones have different display forms, some are called background protection, and they may also be called whitelist). 3) Whether to log in to the PC version and the web version at the same time, if you log in, you need to turn on the "Mobile New Message Reminder" in the "Using the PC version of Yixin" at the top of the mobile message list. >>>More

21 answers2024-05-20

It is recommended to use defoamers in a targeted manner, and food additive defoamers may not have a very good defoaming effect in sewage treatment.