C # window interception of Keyboard Events

Source: Internet
Author: User

Sometimes it is necessary to intercept keyboard events so that the program can be executed according to the designer's requirements.

Protected override void WndProc (ref Message m)
{
Const int WM_HOTKEY = 0x0312; // hotkey message
If (m. Msg = WM_HOTKEY)
{
// Max. Minimal hotkey

}

// When the center pulley event is right-clicked, the screen saver timer is cleared. [9/15/2010 huzhonghua]
Const int WM_LBUTTONDOWN = 0x0201;
Const int WM_RBUTTONDOWN = 0x0204;
Const int WM_MOUSEDOWN = 0x0210;
Const int WM_MOUSEWHEEL = 0x020A;
If (m. Msg = WM_MOUSEDOWN | m. Msg = WM_LBUTTONDOWN | m. Msg = WM_RBUTTONDOWN | m. Msg = WM_MOUSEWHEEL)
{
// All Keyboard Events

}
Base. WndProc (ref m );
}

Author: "column of yysyangyangyangshan"

Related Article

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.