Search Tools Links Login

Convert two dWords to a qWord

How to convert two 32-bit dWords to a 64-bit qWord.

Original Author: ULLI

API Declarations

none, pure basic


Option Explicit
Private Type tLoHi 'remember - we are little endian
  Lo As Long
  Hi As Long
End Type
Private Type tCurr
  LoHi As Currency
End Type
Private Function Convert(ByVal HiWord As Long, ByVal LoWord As Long) As Variant
'convert two 32bit dWords to a 64bit qWord
Dim LoHi As tLoHi
Dim Curr As tCurr
  LoHi.Hi = HiWord
  LoHi.Lo = LoWord
  LSet Curr = LoHi
  Convert = CDec(Curr.LoHi) * 10000    'remove decimal point from currency
End Function
Private Sub Command1_Click()
  Print "MaxPos ", Convert(&H7FFFFFFF, &HFFFFFFFF)
  Print "MaxNeg ", Convert(&H80000000, 0)
  Print "Plus 1 ", Convert(0, 1)
  Print "Minus 1", Convert(&HFFFFFFFF, &HFFFFFFFF)
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 154 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.