How to obtain keycode in VB

Source: Internet
Author: User
The following Code Only the right-click shielding, CTRL + N, Shift + F10, F5 refresh, and backspace keys are implemented.
Function keydown (){
// Shield right-click, CTRL + N, Shift + F10, F5 refresh, and backspace key
// Alert ("ASCII Code:" + event. keycode );
If (window. event. altkey )&&
(Window. event. keycode = 37) | // mask Alt + direction key seek
(Window. event. keycode = 39) {// mask Alt + direction key →
Alert ("You are not allowed to use Alt + arrow keys to move forward or backward the webpage! ");
Event. returnvalue = false;
}
If (event. keycode = 8) | // shield the unregeed deletion key
(Event. keycode = 116) | // block the F5 refresh key
(Event. keycode = 112) | // block the F1 refresh key
(Event. ctrlkey & event. keycode = 82) {// Ctrl + R
Event. keycode = 0;
Event. returnvalue = false;
}
If (event. ctrlkey) & (event. keycode = 78) // block Ctrl + n
Event. returnvalue = false;
If (event. shiftkey) & (event. keycode = 121) // block SHIFT + F10
Event. returnvalue = false;
If (window. event. srcelement. tagname = "A" & window. event. shiftkey)
Window. event. returnvalue = false; // block shift with the left mouse button to open a new page
If (window. event. altkey) & (window. event. keycode = 115) {// block Alt + F4
Window. showmodelessdialog ("about: blank", "", "dialogwidth: 1px; dialogheight: 1px ");
Return false ;}
}

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.