Microsoft DirectX 8.1 (Visual Basic) |
Some Microsoft® DirectX® types, such as D3DCAPS8 have Long members that serve as bitmasks. Bitmasks are similar to flag fields, but they are normally used to mask off certain bits in a field. It is customary to use hexadecimal format to assign values to these bitmasks because it is easier to determine which bits will be affected. However, doing so may cause an error because Microsoft Visual Basic® normally attempts to convert hexadecimal constants to the shortest type. For example, &HFF would be converted to an Integer with a value of -1. If this value is then passed back to DirectX for Visual Basic, where a Long is expected, it is converted to &HFFFFFFFF.
To ensure that a hexadecimal bitmask is properly converted, place a second ampersand after the expression. For example:
DDSD.ddpfPixelFormat.lRBitMask = &HFF&