The hexadecimal notation system is a base-16 number system used for representing numbers in computer programming.
- &H1 = decimal 1
- &H10 = decimal 16
- &H100 = decimal 256
These values can be used to represent different keys on a keyboard, such as the shift key (&H10), the control key (&H11), and so on.
Why Use Hexadecimal Notation?
Hexadecimal notation is useful for representing binary data in a more human-readable format. It's often used to represent hexadecimal values that are not easily readable in decimal form.
- &H1 = binary 00000001
- &H10 = binary 00010000
- &H8000 = binary 11000000
When using hexadecimal notation, you can easily see the binary representation of a value by looking at its hexadecimal equivalent.
How to Use Hexadecimal Notation in Visual Basic?
In Visual Basic, you can use hexadecimal notation to represent different keys on a keyboard. For example:
- &H10 = VK_SHIFT
- &H11 = VK_CONTROL
- &H12 = VK_ALT
To check if the ALT key has been pressed, you can use the following code:
Public Const VK_ALT = &H12
Dim IsALT As Boolean
IsALT = (GetKeyState(VK_ALT) And &H8000) 'Ctrl Key
Sources:- [
What are &H1, &H8000, etc.? | Tek-Tips] (
https://www.tek-tips.com/threads/what-are-h1-h8000-etc.1080522/)
- [
Microsoft VBScript runtime error '800a01b6' | Tek-Tips] (
https://www.tek-tips.com/threads/microsoft-vbscript-runtime-error-800a01b6.419805/)
- [
Error: Only content controls are allowed directly in a ... - Tek-Tips] (
https://www.tek-tips.com/threads/error-only-content-controls-are-allowed-directly-in-a-content-page.1504551/)
- [
VBA NotifyIcon | Tek-Tips] (
https://www.tek-tips.com/threads/vba-notifyicon.1521979/)
- [
Why does font-size not inherit ? | Tek-Tips] (
https://www.tek-tips.com/threads/why-does-font-size-not-inherit.1050326/)
- [
JOIN from HOLD Files possible? | Tek-Tips] (
https://www.tek-tips.com/threads/join-from-hold-files-possible.490981/)
- [
Launch .VBS file from button on HTML page | Tek-Tips] (
https://www.tek-tips.com/threads/launch-vbs-file-from-button-on-html-page.931380/)
- [
Vb6 Excel Set Range NumberFormat | Tek-Tips] (
https://www.tek-tips.com/threads/vb6-excel-set-range-numberformat.1702432/)
- [
resolving template conflict? | Tek-Tips] (
https://www.tek-tips.com/threads/resolving-template-conflict.1086638/)
- [
JTable: scroll to get the entered row number at the top of screen] (
https://www.tek-tips.com/threads/jtable-scroll-to-get-the-entered-row-number-at-the-top-of-screen.1541922/)