如题,请各位解释一下

解决方案 »

  1.   

    http://topic.csdn.net/u/20100408/11/017964a9-5424-48d0-9965-5646561d67c8.html
      

  2.   

    http://www.moon-soft.com/doc/19154.htm
      

  3.   

    Windows uses two methods to route messages to a window procedure: (1) posting messages to a first-in, first-out queue called a message queue, which is a system-defined memory object that temporarily stores messages; and (2) sending messages directly to a window procedure. Messages posted to a message queue are called queued messages. They are primarily the result of user input via the mouse or keyboard, such as WM_MOUSEMOVE, WM_LBUTTONDOWN, WM_KEYDOWN, and WM_CHAR messages. Other queued messages include the timer, paint, and quit messages: WM_TIMER, WM_PAINT, and WM_QUIT. Most other messages are sent directly to a window procedure and are called, surprisingly enough, nonqueued messages.Queued Messages
    Windows NT maintains a single system-message queue and any number of thread-message queues, one for each thread. Whenever the user moves the mouse, clicks the mouse buttons, or types at the keyboard, the device driver for the mouse or keyboard converts the input into messages and places them in the system-message queue. Windows removes the messages, one at a time, from the system-message queue, examines them to determine the destination window, and then posts them to the message queue of the thread that created the destination window. A thread's message queue receives all mouse and keyboard messages for the windows created by the thread. The thread removes messages from its queue and directs Windows NT to send them to the appropriate window procedure for processing. The system posts a message to a thread's message queue by filling an MSG structure and then copying it to the message queue. Information in the MSG structure includes the handle of the window for which the message is intended, the message identifier, the two message parameters, the message time, and the mouse-cursor position. A thread can post a message to its own message queue or to the queue of another thread by using the PostMessage or PostThreadMessage function.Nonqueued Messages
    Nonqueued messages are sent immediately to the destination window procedure, bypassing the system-message queue and thread-message queue. Windows typically sends nonqueued messages to notify a window of events that affect it. For example, when the user activates a new application window, Windows sends the window a series of messages, including WM_ACTIVATE, WM_SETFOCUS, and WM_SETCURSOR. These messages notify the window that it has been activated, that keyboard input is being directed to the window, and that the mouse cursor has been moved within the borders of the window. Certain Windows function calls can prompt nonqueued messages. For example, Windows sends the WM_WINDOWPOSCHANGED message after an application uses the SetWindowPos function to move a window.
      

  4.   

    消息分为队列消息(进入线程的消息队列)和非队列消息(不进入线程的消息队列)。对于队列消息,最常见的是鼠标和键盘触发的消息,例如WM_MOUSERMOVE,WM_CHAR等消息;还有例如:WM_PAINT、WM_TIMER和WM_QUIT。当鼠标、键盘事件被触发后,相应的鼠标或键盘驱动程序就会把这些事件转换成相应的消息,然后输送到系统消息队列,由Windows系统负责把消息加入到相应线程的消息队列中,于是就有了消息循环(从消息队列中读取并派送消息)。还有一种是非队列消息,他绕过系统队列和消息队列,直接将消息发送到窗口过程。例如,当用户激活一个窗口系统发送WM_ACTIVATE, WM_SETFOCUS, and WM_SETCURSOR。创建窗口时发送WM_CREATE消息。在后面你将看到,MS这么设计是很有道理的,以及他的整套实现机制
      

  5.   

    进队的,就是PostMessage,就是需要消息队列来处理,是异步,
    不进队,就是SendMessage,就是直接要求窗口过程函数来处理,一般用于同步
      

  6.   

    进队的,就是PostMessage,就是需要消息队列来处理,是异步,
    不进队,就是SendMessage,就是直接要求窗口过程函数来处理,一般用于同步
      

  7.   

    SendMessage:不进队,主要是向一个或多个窗口发送一条消息,一直等到消息被处理之后才会返回。
    PostMessage:进队,把一条消息放置到创建hWnd窗口的线程的消息队列中,该函数不等消息被处理就马上将控制返回。