As we delve into the fascinating realm of Visual Basic (Classic), it's essential to understand some fundamental concepts. In this blog post, we'll explore what &H1, &H8000, etc., mean and how they relate to the world of programming.
In a thread on Tek-Tips, a programmer named Ovatvvon sought clarification on what &H1 and &H8000 meant. ADoozer, another seasoned programmer, provided a helpful explanation, stating that &H means the number is hexadecimal (ie base 16). &H1 equals decimal 1, while &H8000 translates to decimal 32768.
Sheco further elaborated on the purpose of &H8000 in GetKeyState function. In binary, VK_SHIFT (&H10) would be: 0000000000000010. If Shift is down, GetKeyState returns: 1000000000000010. Using bitwise AND to test this value, we get: 1000000000000000 = &H8000. So, if we want to check whether the ALT key has been pressed or not, we would assign it a value of &H12.
We'll also explore how to use this information in real-world scenarios, such as creating functions that copy text from an input box to the clipboard when the user selects ALT and X. With these concepts under our belt, we'll be well-equipped to tackle more complex programming tasks.
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/)
- [
Microsoft VBScript runtime error '800a01b6' | Tek-Tips] (
https://www.tek-tips.com/threads/microsoft-vbscript-runtime-error-800a01b6.419805/)
- [
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/)
- [
Send 8-bit data over serial port; values over 3F are being set to 3F] (
https://www.tek-tips.com/threads/send-8-bit-data-over-serial-port-values-over-3f-are-being-set-to-3f.1672795/)
- [
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/)
- [
Coverage Paths | Tek-Tips] (
https://www.tek-tips.com/threads/coverage-paths.1632312/)
- [
Forwarding one internal extension to External number | Tek-Tips] (
https://www.tek-tips.com/threads/forwarding-one-internal-extension-to-external-number.1574548/)
- [
VBA NotifyIcon | Tek-Tips] (
https://www.tek-tips.com/threads/vba-notifyicon.1521979/)
- [
JOIN from HOLD Files possible? | Tek-Tips] (
https://www.tek-tips.com/threads/join-from-hold-files-possible.490981/)