Results 1 to 3 of 3

Thread: Shifting bits

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    156

    Question

    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
    The MORE I get to know,
    I realize that I know NOTHING !

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    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
    Mark
    -------------------

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    156

    Smile

    thanks mate

    that 1 i know,

    but thanks any way


    lirlir
    The MORE I get to know,
    I realize that I know NOTHING !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width