Essentially, when a LONG is passed from VB to PB (and PB is expecting a DWORD), PB reads the 32-bit value directly off the stack directly (ie, it does not "convert" it from signed to unsigned).
So, as Eric noted, you can generally interchange DWORD and LONG data types. What sort of values are you passing back and forth, and how are you using them? This is really what will determine whether you can use this strategy successfully.
------------------
Lance
PowerBASIC Support
mailto:[email protected][email protected]</A>
Announcement
Collapse
No announcement yet.
PB DWORD = VB LONG?
Collapse
X
-
Guest repliedNo, a PB LONG = VB LONG.
Last time I looked, VB didn't have a DWORD data type. DWORDs and LONGs are both 4-byte integers that use the same bit formats (except for the meaning of one bit) so they can often be used interchangably, but not always.
A LONG can hold integer values from negative 2.1 billion to positive 2.1 billion, for a range of 4.2 billion.
A DWORD can hold integer values from zero to positive 4.2 billion. If you use them interchangably and a value outside the legal range is stored, it (usually) will be converted. For example, if you store &hFFFF in a LONG you will get negative 1, and if you store &hFFFF in a DWORD you will get 4.2 billion.
-- Eric
PB help file, it is obvious there is not type which will hold a
PB DWORD. My question was geared toward creating a VB declare
statement which calls a PB DLL which has a DWORD as an argument.
Josh
------------------
Leave a comment:
-
Lance, you're right. I made a couple of F'ing mistakes.
Everyplace I wrote FFFF it should say FFFFFFFF.
-- Eric
------------------
Perfect Sync Development Tools
Perfect Sync Web Site
Contact Us: mailto:[email protected][email protected]</A>
[This message has been edited by Eric Pearson (edited March 23, 2001).]
Leave a comment:
-
Eric, you may be missing a few f's on those examples, but the intent of your message is clear.
------------------
Lance
PowerBASIC Support
mailto:[email protected][email protected]</A>
Leave a comment:
-
VB doesn't have anything that uses the same format as a PB QUAD. The closest you could come (as far as I know) would be a LARGE_INTEGER structure, as defined by the Win32 API.
-- Eric
P.S. My information may be out of date. I stopped buying VB upgrades at 5.0.
------------------
Perfect Sync Development Tools
Perfect Sync Web Site
Contact Us: mailto:[email protected][email protected]</A>
Leave a comment:
-
No, a PB LONG = VB LONG.
Last time I looked, VB didn't have a DWORD data type. DWORDs and LONGs are both 4-byte integers that use the same bit formats (except for the meaning of one bit) so they can often be used interchangably, but not always.
A LONG can hold integer values from negative 2.1 billion to positive 2.1 billion, for a range of 4.2 billion.
A DWORD can hold integer values from zero to positive 4.2 billion. If you use them interchangably and a value outside the legal range is stored, it (usually) will be converted. For example, if you store &hFFFF in a LONG you will get negative 1, and if you store &hFFFF in a DWORD you will get 4.2 billion.
-- Eric
------------------
Perfect Sync Development Tools
Perfect Sync Web Site
Contact Us: mailto:[email protected][email protected]</A>
[This message has been edited by Eric Pearson (edited March 23, 2001).]
Leave a comment:
-
Guest repliedAnother:
PB QUAD = VB ???
Thanks,
Josh
------------------
Leave a comment:
-
PB DWORD = VB LONG?
I have a quick question. Does a PB DWORD = VB LONG?
Thanks,
Josh
------------------
Tags: None
Leave a comment: