Announcement

Collapse
No announcement yet.

How to VARIANT_BOOL use?

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

  • How to VARIANT_BOOL use?

    I have a problem with type -> VARIANT_BOOL

    How can I use it in code?

    Code:
    ..
    LET vVariable = %FALSE  ' or %TRUE
    
    OBJECT CALL oObject.SetVariables(vVariable)
    ..thus does not function

    Help me please.
    Thanks
    Yours sincerely

  • #2
    Is it impossible in PB?
    Yours sincerely

    Comment


    • #3
      Use the following function:

      Code:
      ' ========================================================================================
      ' Makes a boolean variant with the %VT_BOOL flag set.
      ' ========================================================================================
      SUB MKVTBOOL (BYREF vVar AS VARIANT, BYVAL fBool AS INTEGER)
         LOCAL pv AS VARIANTAPI PTR                     ' Pointer to a VARIANTAPI structure
         vVar = EMPTY                                   ' Make sure is empty to avoid memory leaks
         pv = VARPTR(vVar)                              ' Get the VARIANT address
         @pv.vt = %VT_BOOL                              ' Mark it as containing a boolean value
         IF fBool THEN fBool = -1                       ' Make sure is 0 or -1
         @pv.vd.boolVal = fBool                         ' Set the boolean value
      END SUB
      ' ========================================================================================
      Don forget to include WIN32API.INC, where the VARIANTAPI structure is defined.
      Forum: http://www.jose.it-berater.org/smfforum/index.php

      Comment


      • #4
        Super! It runs now.
        Thank you José Roca!
        Yours sincerely

        Comment

        Working...
        X