Open topic with navigation
Determines if a bit is set in a bit field
Declare Function pp_bittest(ByVal bit_field As Long, ByVal bit_number As Long) As Long
LONG pp_bittest(LONG bit_field, LONG bit_number)
<bit_field> is a bit field on which to work
<bit_number> is the bit number in the bit field to test, 1 to 32
PP_FALSE  (bit not set) or PP_TRUE  (bit set)
There are several long integers in the License File that may be used as bit-fields. A bit field contains 32 bits that can be used to store the state of multiple binary or on/off attributes. The state of those attributes are either enabled or disabled. This is typically used to license various modules or features on a pay-per-module basis.
This function along with pp_bitclear() and pp_bitset() work together to provide you with total bit field manipulation capability.
' This application allows various options to be purchased.
' The user's purchased configuration is stored in one of
' the user-defined numerics. We will check to see which
' options should be enabled.
Global Const DATAMODULE_1 = 1
Global Const DATAMODULE_2 = 2
Global Const FEATURE_1 = 3
Global Const FEATURE_2 = 4
Dim options As Long
pp_getvarnum lfhandle, VAR_UDEF_NUM_2, options
If pp_bittest options, DATAMODULE_1 Then
' Enable access to Data Module #1
Else If pp_bittest options, DATAMODULE_2 Then
' Enable access to Data Module #2
Else If pp_bittest options, FEATURE_1 Then
' Enable Feature #1
Else If pp_bittest options, FEATURE _2 Then
' Enable Feature #2
PP_BITSET() and PP_BITCLEAR()