Bitwise Operations 9-20-04
Vitals
Description
Downloads
Status: Release/Final
Language: Visual Basic 6
Platform: Win9x, WinNT, Win2000/XP
Downloads: 43

Bitwise Operations is an app I created to assist in programming, particularly when using API function calls. As you may or may not know, many Windows API functions return or have parameters that are merely binary. The first byte might contain a virtual keycode while the next could hold the state of the key modifiers in single bits. Even if you know how to use bitwise operators and what bits hold which information, it's hard to visualize the bits and convert them to the required hexadecimal or decimal number formats. This program allows you to convert between binary, hex, and decimal by allowing you to toggle each bit in 4 bytes or enter the number in the decimal and hex boxes. Then, through the use of my carefully crafted GUI, it's easy to take numbers you've entered and come up with a formula for extracting certain bits from function returns.

In the example screenshot, I have copied the decimal return from a function. Then, since I know that the data I'm looking for is in the third byte only, I show how to use the bitwise in hex to return only that byte and divide out the lower bytes. Then the final box shows the output of 30. There's also an option for using Or bitwise operations, but I haven't found a use for that yet.

The way you code bitwise operations in VB6 is to take the return and binary compare ...
 



SnakeByte Content Browser 2.0b (bld 12-4-10)