Windows API Guide: LB_GETCOUNT Message


Public Function MAKEWORD(ByVal bLow As Byte, ByVal bHigh As Byte) As Integer MAKEWORD = Val("&H" & Right("00" & Hex(bHigh), 2) & Right("00" & Hex(bLow), 2)) End Function

Description & Usage

MAKEWORD creates a word by concatenating two individual bytes.

Return Value

The macro returns the 16-bit integer generated by the two bytes.

Visual Basic-Specific Issues

Although it may seem unusual to use string operations for what would otherwise be a mathematical computation, it is necessary to implement MAKEWORD this way in VB. Other methods to perform this task can fail for large inputs because VB interprets them as negative values, which causes an equivalent mathematical computation to return an unwanted value.

Parameters

bLow
The low-order byte of the new 16-bit integer.
bHigh
The high-order byte of the new 16-bit integer.

See Also

HIBYTE, LOBYTE

Back to the Macro list.
Back to the Reference section.


Last Modified: October 29, 2000
This page is copyright © 2000 Paul Kuliniewicz. Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/m/makeword.html



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net