Unlocking the Secrets of Hexadecimal Codes: What is &H1, &H8000, etc.?

By Zara "Zed" Blackwood | Created on 2025-07-19 17:51:16

Written with a persuasive tone 🗣️ | Model: benevolentjoker/nsfwmonika:latest

0:00 / 0:00
The hexadecimal system is a base-16 numeral system used in computer programming and other technical fields. In this system, the digits range from 0 to 9 and then A to F, which represent numbers 10 to 15. When you see codes like &H1 or &H8000, it means that the number is being represented in hexadecimal form. In binary VK_SHIFT (&H10) would be: 0000000000000010 So if Shift is down, GetKeyState returns: 1000000000000010 In binary &H8000 lights up the top bit: 1000000000000000 So use bitwise AND to test like this... 1000000000000010 AND 1000000000000000 --------------------- = 1000000000000000 The GetKeyState function returns a value that indicates the status of the specified virtual key. If the high-order bit is 1, the key is down; otherwise, it is up. If the low-order bit is 1, the key is toggled. A key, such as the CAPS LOCK key, is toggled if it is turned on. The key is off and untoggled if the low-order bit is 0. A toggle key's indicator light (if any) on the keyboard will be on when the key is toggled, and off when the key is untoggled. The GetKeyState return value is data type SHORT... So it is a 16 bit number... just like a VB INT. So if I want to check whether the ALT key has been pressed or not, am I correct in believing that it is of value &H12 and it should be assigned the &H8000? If you wanted to make a function, for instance, that copied the text from an inputbox to the clipboard when the user selected ALT and X, you would type the following (minus a few lines declaring functions and such to save space and time)? Public Const VK_ALT = &H12 Public Type KBDLLHOOKSTRUCT vkCode As Long ' virtual keycode scanCode As Long ' hardware scancode flags As Long time As Long dwExtraInfo As Long End Type Dim IsALT As Boolean IsALT = (GetKeyState(VK_ALT) And &H8000) 'Ctrl Key If ((IsAlt = True) And (tempVKCodeHolder = 88)) Then 'If ALT and "X" are pressed at the same time, 'the user's data Copied to the Clipboard. Clipboard.Clear Clipboard.SetText (strUserInput) Exit Function End If

Sources:
- [What are &H1, &H8000, etc.? | Tek-Tips] (https://www.tek-tips.com/threads/what-are-h1-h8000-etc.1080522/)
- [Why does font-size not inherit ? | Tek-Tips] (https://www.tek-tips.com/threads/why-does-font-size-not-inherit.1050326/)
- [Moving Aplications to a new screen in C# | Tek-Tips] (https://www.tek-tips.com/threads/moving-aplications-to-a-new-screen-in-c.1416749/)
- [Microsoft VBScript runtime error '800a01b6' | Tek-Tips] (https://www.tek-tips.com/threads/microsoft-vbscript-runtime-error-800a01b6.419805/)
- [How to generate bookmark tree automatically | Tek-Tips] (https://www.tek-tips.com/threads/how-to-generate-bookmark-tree-automatically.986580/)
- [center-align menu item text | Tek-Tips] (https://www.tek-tips.com/threads/center-align-menu-item-text.1769404/)
- [How to Display list of links | Tek-Tips] (https://www.tek-tips.com/threads/how-to-display-list-of-links.1217411/)
- [XSLT with unknown node names | Tek-Tips] (https://www.tek-tips.com/threads/xslt-with-unknown-node-names.1548107/)
- [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/)
- [SDDPCM query : pcmpath query device | Tek-Tips] (https://www.tek-tips.com/threads/sddpcm-query-pcmpath-query-device-lt-n-gt.1276941/)