|
|
VB-Helper DLL
(32-bit),
Copyright © 1996 SoftCircuits
Redistributed by Permission
Declare Function vbGetAddress Lib
"VBHLP32.DLL" (pData As
Any) As Long
Description:
Returns the address of pData
Note that Visual Basic passes a copy
of some variables (for example,
variable-length strings and
user-defined types that contain
strings) when calling DLL functions.
In these cases the value returned by
vbGetAddress is not normally helpful
since it will be the address of the
copy which is temporary.
Declare Sub vbFillMemory Lib
"VBHLP32.DLL" (pDest As
Any, ByVal nValue As Byte, ByVal
nCount As Long)
Description:
Fills an area of memory with the
specified value.
pDest is the address of the memory to
be modified,
nValue is the value that each byte
will be set to, and
nCount is the number of bytes to
fill.
Declare Sub vbCopyMemory Lib
"VBHLP32.DLL" (pDest As
Any, pSource As Any, ByVal nCount As
Long)
Description:
Copies an area of memory to another
location. If portions of the source
and destination memory overlap, steps
are taken to ensure data is copied
correctly.
pDest is the address of the memory to
be copied to,
pSource is the address of the memory
to be copied from, and
nCount is the number of bytes to
copy.
Declare Function vbLoByte Lib
"VBHLP32.DLL" (ByVal nValue
As Integer) As Integer
Description:
Returns the low-order byte of nValue
Declare Function vbHiByte Lib
"VBHLP32.DLL" (ByVal nValue
As Integer) As Integer
Description:
Returns the high-order byte of nValue
Declare Function vbLoWord Lib
"VBHLP32.DLL" (ByVal nValue
As Long) As Integer
Description:
Returns the low-order word of nValue
Declare Function vbHiWord Lib
"VBHLP32.DLL" (ByVal nValue
As Long) As Integer
Description:
Returns the high-order word of nValue
Declare Function vbMakeWord Lib
"VBHLP32.DLL" (ByVal
nLoByte As Integer, ByVal nHiByte As
Integer) As Integer
Description:
Combines two byte values into a word
value.
Declare Function vbMakeLong Lib
"VBHLP32.DLL" (ByVal
nLoWord As Integer, ByVal nHiWord As
Integer) As Long
Description:
Combines two word values into a long
value.
Declare Function vbShiftRight Lib
"VBHLP32.DLL" (ByVal nValue
As Integer, ByVal nBits As Integer)
As Integer
Description:
Shifts the bits in nValue
right the number of times specified
by nBits
The left-most bits opened up by the
shift are set to 0.
Declare Function vbShiftLeft Lib
"VBHLP32.DLL" (ByVal nValue
As Integer, ByVal nBits As Integer)
As Integer
Description:
Shifts the bits in nValue
left the number of times specified by
nBits
The right-most bits opened up by the
shift are set to 0.
Declare Function vbShiftRightLong Lib
"VBHLP32.DLL" (ByVal nValue
As Long, ByVal nBits As Integer) As
Long
Description:
Shifts the bits in nValue
right the number of times specified
by nBits
The left-most bits opened up by the
shift are set to 0.
Declare Function vbShiftLeftLong Lib
"VBHLP32.DLL" (ByVal nValue
As Long, ByVal nBits As Integer) As
Long
Description:
Shifts the bits in nValue
left the number of times specified by
nBits
The right-most bits opened up by the
shift are set to 0.
Declare Function vbRotateRight Lib
"VBHLP32.DLL" (ByVal nValue
As Integer, ByVal nBits As Integer)
As Integer
Description:
Rotates the bits in nValue
right the number of times specified
by nBits
For each rotation, the right-most bit
is copied to the left-most bit.
Declare Function vbRotateLeft Lib
"VBHLP32.DLL" (ByVal nValue
As Integer, ByVal nBits As Integer)
As Integer
Description:
Rotates the bits in nValue
left the number of times specified by
nBits
For each rotation, the left-most bit
is copied to the right-most bit.
Declare Function vbRotateRightLong
Lib "VBHLP32.DLL" (ByVal
nValue As Long, ByVal nBits As
Integer) As Long
Description:
Rotates the bits in nValue
right the number of times specified
by nBits
For each rotation, the right-most bit
is copied to the left-most bit.
Declare Function vbRotateLeftLong Lib
"VBHLP32.DLL" (ByVal nValue
As Long, ByVal nBits As Integer) As
Long
Description:
Rotates the bits in nValue
left the number of times specified by
nBits
For each rotation, the left-most bit
is copied to the right-most bit.
Declare Sub vbPackUDT Lib
"VBHLP32.DLL" (pUDT As Any,
ppResult As Long, ByVal pszFields As
String)
Description:
Creates of copy of a user-defined
type (UDT) and removes any padding
that VB may have added as a result of
DWORD alignment.
32-bit versions of Visual Basic will
insert bytes into UDT variables as
padding to keep 32-bit members
aligned on a 32-bit address. This
padding can result in more efficient
member access on 32-bit processors.
However, Visual Basic provides no
workaround for those rare instances
where you need to interface with API
or DLL functions that take UDTs with
no padding. In these cases, you can
use
vbPackUDT to create a copy of a UDT
and remove any padding that VB may
have added.
pUDT is the UDT variable to be
packed.
vbPackUDT makes a copy of this UDT
and places the address of the copy in
ppResult.
pszFields is a string that contains
one character for each member of the
UDT.
Each character indicates the type of
each member and must be one of the
following characters:
"s" Variable-length string
"b" Byte or String * 1
"i" Integer or Boolean
"l" Long
"f" Single (float)
"d" Double
For UDTs that contain arrays, you
must repeat the member type for each
item in the array. For fixed-length
strings, use "b" for each
character in the string.
On return,
ppResult contains the address of the
packed data or 0 if one of the field
codes was invalid or there was not
enough system memory.
Some precautions must be taken when
using vbPackUDT
Each time this routine is called, a
block of memory is allocated from the
system. When the DLL unloads, this
memory will automatically be freed.
However, if your program might call
vbPackUDT more than once before
terminating, you should call
vbPackUDTFree each time to explicitly
release allocated memory. Note,
however, that if you need to unpack
the UDT after the call, you must not
free the memory before calling
vbUnpackUDT
In addition, UDTs with
variable-length strings require
additional precautions. For these
UDTs, vbPackUDT will allocate a
separate block of memory to hold the
actual string data. Therefore, you
should avoid copying the packed data
of UDTs with variable-length strings
as the string members will refer to
memory that is located elsewhere and
may be temporary. Also, when calling
vbUnpackUDT to unpack a UDT that
contains variable-length strings,
make sure the string members in the
UDT passed to vbUnpackUDT are big
enough to hold the string returned.
Declare Sub vbUnpackUDT Lib
"VBHLP32.DLL" (pUDT As Any,
ppResult As Long)
Description:
Unpacks a user-defined type (UDT)
packed by vbPackUDT
pUDT is the UDT to receive the data.
This UDT must be of the same type
that was passed to vbPackUDT when the
data was packed.
ppResult must be a value obtained
from the call to vbPackUDT
For UDTs that contain variable-length
strings, you must ensure that string
members are big enough to hold the
string being returned. Normally, this
simply means that you should not
reduce the size of variable-length
string members between the call to
vbPackUDT and vbUnpackUDT
Declare Function vbPackUDTGetSize Lib
"VBHLP32.DLL" (ppResult As
Long) As Long
Description:
Returns the size of a user-defined
type (UDT) packed by vbPackUDT
ppResult must be a value obtained
from the call to vbPackUDT
If ppResult is not a valid packed UDT
value, this function returns 0.
Note: You should not make any
assumptions about the actual size of
the memory block allocated by
vbPackUDT which will be bigger than
the value returned by
vbPackUDTGetSize
Declare Sub vbPackUDTFree Lib
"VBHLP32.DLL" (ppResult As
Long)
Description:
Frees the memory allocated for a
user-defined type (UDT) packed by
vbPackUDT
ppResult must be a value obtained
from the call to vbPackUDT
If this function is successful,
ppResult is set to 0.
Each time you call vbPackUDT, a block
of memory is allocated from the
system. When the DLL unloads, this
memory will automatically be freed.
However, if your program might call
vbPackUDT more than once before
terminating, you should call
vbPackUDTFree each time to explicitly
release allocated memory. Note,
however, that if you need to unpack
the UDT after the call, you must not
free the memory before calling
vbUnpackUDT
Declare Sub vbShowAboutBox Lib
"VBHLP32.DLL" ()
Description:
Opens a dialog box that displays
version and copyright information for
VBHLP32.DLL.
Declare Function vbGetHelperVersion
Lib "VBHLP32.DLL" () As
Integer
Description:
Returns the VB-Helper DLL version.
The high byte contains the major
version, and the low byte contains
the minor version. For example, a
return value of &H20A would
indicate version 2.10.
About SoftCircuits
SoftCircuits Programming
P.O. Box 16262
Irvine, CA 92623
For the latest information about
SoftCircuits, visit us on the World
Wide Web at
http://www.softcircuits.com.
SoftCircuits is a trademark and
SoftCircuits Programming is a
registered trademark of SoftCircuits.
Revision History
This section is set aside for
tracking program revisions.
Version 2.00
Comments
Original 32-bit Version. Note: A
similar 16-bit DLL with the same name
received very little distribution. If
your application is 32-bit running
under a 32-bit operating system and
you call into this DLL, you can
safely assume that it is version 2.00
or higher.
|
|
|