Difference between setfocus, setcapture, and setactiveview

Source: Internet
Author: User

1. the toolbar and menu bar button messages are the so-called command messages. The message transmission method is to turn back (according to instructor Hou Junjie), and the message will first go to view, here, the view is the activity view of MFC, Which is set with setactiveview.
2. The mouse and keyboard messages are common Windows messages, which are delivered in a straight line. The scroll wheel and keyboard messages are sent to the view with the focus and set with setfocus. If the focus is not set, messages are sent to the activeview; A message such as clicking, double-clicking, and right-clicking will be sent to the attempt with capture and set with setcapture. If no setting is set, it will go to windowfrompoint (to obtain the handle of the window containing the specified vertex.

The following is the definition of msdn:

In fact, you can see the definition of msdn.
They all have differences.
Setcapture
This function sets the mouse or style capture to a specified window that belongs to the current thread. after you call this function for a window, the window captures mouse input that occurs while the mouse cursor remains within the window. the window also captures mouse input that occurs when the user presses a mouse button while the mouse cursor is located within the window and continues to hold the mouse button down while moving the mouse. only one window at a time can capture the mouse or stylus.

setfocus function
the setfocus function sets the keyboard focus to the specified window. The window must be attached to the calling thread's message queue.

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.