The information in this article applies to:
SUMMARY
The correction below applies to the KEY statement in the following
manuals:
...a keyboardflag value of &H12 would test for both CTRL and ALT being pressed.The keyboardflag value should be &H0C on a non-extended keyboard, not &H12, to test for both CTRL and ALT being pressed. The keyboardflag value should be &H8C on an extended keyboard. This example incorrectly uses decimal addition on hexadecimal numbers. MORE INFORMATIONThe following Basic program gives an example of trapping the CTRL+ALT+DEL keystroke sequence for both extended and non-extended keyboards.
Please note that when you run this program, pressing CTRL+ALT+DEL will
reboot the computer if any of the following key states are also
active:
SHIFT, NUM LOCK, or CAPS LOCKYou must define separate ON KEY(n) statements for trapping CTRL+ALT+DEL in combination with the different states of the SHIFT, NUM LOCK, or CAPS LOCK keys. In the ON KEY(n) statement, n can be 15 through 25; this limits you to 11 user-defined keys. Note: On some machines, even if you trap all combinations of the NUM LOCK, SHIFT and CAPS LOCK keys along with CTRL+ALT+DEL, the trap will fail and the machine will reboot. This occurs because the CTRL+ALT+DEL scancode combination on some computers is configured to a hardware interrupt that occurs before and below Basic's software trap, effectively bypassing the trap and rebooting the machine. The keyboardflag value &H0C in the KEY statement is obtained by adding together the keyboardflag values from the above pages for the CTRL and ALT keys, as in the following example:
When adding together keyboardflag values to trap different
combinations of SHIFT, CTRL, ALT, NUM LOCK, CAPS LOCK, or
Advanced-101-keyboard extended keys, it is important to remember that
the above values are in hexadecimal (base 16) notation, where numbers
are preceded with &H. If you wish, you can convert the number to
decimal notation (base 10) and use that value. If you are using
decimal notation, be sure not to use &H in front of the value in
Basic.
Additional query words: VBmsdos QuickBas BasicCom 4.00 4.00b 4.50 6.00 6.00b 7.00 7.10 restart
Keywords : |
Last Reviewed: December 4, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |