This function uses a Bitwise operation to convert a DWORD into a BitString
Thanks to Patrick Vletter for this sample.
FUNCTION
DW2BitString
(
dwValue
AS
DWORD
)
AS
STRING
STRICT
LOCAL
ptrMem
AS
BYTE
PTR
LOCAL
strBit
AS
STRING
LOCAL
dwI
AS
DWORD
LOCAL
dwBit
AS
DWORD
ptrMem
:=
MemAlloc
(
32
)
FOR
dwI
:=
1
UPTO
32
IF
_And
(
dwValue
,1)==1
dwBit
:=
49
ELSE
dwBit
:=
48
ENDIF
ptrMem
[33-
dwI
]
:=
dwBit
dwValue
:=
dwValue
>>
1
NEXT
strBit
:=
Mem2String
(
ptrMem
,
32
)
MemFree
(
ptrMem
)
RETURN
strBit