Announcement

Collapse
No announcement yet.

How to VARIANT_BOOL use?

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

  • Alexander Holzer
    replied
    Super! It runs now.
    Thank you José Roca!

    Leave a comment:


  • José Roca
    replied
    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.

    Leave a comment:


  • Alexander Holzer
    replied
    Is it impossible in PB?

    Leave a comment:


  • Alexander Holzer
    started a topic How to VARIANT_BOOL use?

    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
Working...
X