-
hi there,
Shifting bits - is it possible on VB ?
cause i execut the API GetLogicalDrivers that return value is a bitmask representing the currently available disk drives. Bit position 0 (the least-significant bit) is drive A, bit position 1 is drive B, bit position 2 is drive C, and so on.
i want to know which 1 of the bits is "on" and which 1 is "off" , and the only way i know is by shifting bits.
my questions are :
1. is it possible shifting bits on VB
2. if not , how can i get all the logical drivers.
thanks ,
lirlir
-
I am not aware of a VB bitshift command but you could just divide by 2 to shift right.
Code:
Option Explicit
Dim a As Byte
Private Sub Command1_Click()
a = a / &H2
Debug.Print a
If a And &H1 Then
Debug.Print "bit 1 is set"
Else
Debug.Print "bit 1 is clear"
End If
End Sub
Private Sub Form_Load()
a = &H8
Debug.Print a
End Sub
-
thanks mate
that 1 i know,
but thanks any way
lirlir