Announcement

Collapse
No announcement yet.

And &h0000

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • And &h0000

    How can I test for &H0000 with AND?

    Code:
    #COMPILE EXE
    #DIM ALL
    
    %A = &H0000 'Without changing this value, how can I test for it below?
    %B = &H0001
    %C = &H0002
    %D = &H0004
    %E = &H0008
    
    SUB GetOptions (dwOptions AS DWORD)
    
        LOCAL sMsg AS STRING
    
        IF (dwOptions AND %A) THEN sMsg = sMsg & "A" & ","
        IF (dwOptions AND %B) THEN sMsg = sMsg & "B" & ","
        IF (dwOptions AND %C) THEN sMsg = sMsg & "C" & ","
        IF (dwOptions AND %D) THEN sMsg = sMsg & "D" & ","
        IF (dwOptions AND %E) THEN sMsg = sMsg & "E" & ","
        
        MSGBOX sMsg
    
    END SUB
    
    FUNCTION PBMAIN ( ) AS LONG
        GetOptions %A           'Blank messagebox
        GetOptions %A OR %B     '"B,"
        GetOptions %C OR %D     '"C,D,"
        GetOptions &hFFFF       '"B,C,D,E,"
    END FUNCTION
    LOCAL MyEMail AS STRING
    MyEmail = STRREVERSE$("53pmohtj") & CHR$(64) & STRREVERSE$("liamg") & CHR$(46) & STRREVERSE$("moc")

  • #2
    >How can I test for &H0000 with AND?
    Code:
      if DwOptions = 0 THEN 
    ...
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      John,
      option %A looks like it means "none of the others" as if any other option is set then A is not so it can't be tested the way you're doing it.
      You need to use 1,2,4,8,16 instead of 0,1,2,4,8 for your masks.

      Paul.

      Comment


      • #4
        OR...
        Code:
        IF (dwOptions AND %A) THEN sMsg = sMsg & "A" & ","
        IF (dwOptions AND %B)  THEN...
        ==>
        Code:
        IF (dwOptions AND %A)  = A% THEN sMsg = sMsg & "A" & ","
        IF (dwOptions AND %B)  = B% THEN .....
        Michael Mattias
        Tal Systems Inc. (retired)
        Racine WI USA
        [email protected]
        http://www.talsystems.com

        Comment

        Working...
        X