Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
Public Function THIRD_IPADDRESS (ByVal ipAddress As Long) As Long THIRD_IPADDRESS = Val("&H" & Mid(Right("00000000" & Hex(ipAddress), 8), 5, 2)) End Function
Description & Usage
THIRD_IPADDRESS extracts the third field (field 2) from an IP address packed inside a 32-bit integer. The IP address must be in host byte order.
Return Value
The macro returns the value of the third field of the IP address.
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 THIRD_IPADDRESS 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
- ipAddress
- The IP address to get the third field of. The IP address must be packed into a 32-bit integer in host byte order.
See Also
FIRST_IPADDRESS, FOURTH_IPADDRESS, SECOND_IPADDRESS
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/t/third_ipaddress.html