Class: IPAddressInput in Category Microsoft Visual Basic 6 : Controls from Total Visual SourceBook

Class that implements the IP Address Input Windows common control in VB6.

This class implements routines for creating and manipulating the IP Address control in the Internet Explorer common control library. This class requires version 4.71 or later of COMCTL32.DLL. Please note that you cannot simply redistribute COMCTL32.DLL with your application.

Procedure Name Type Description
(Declarations) Declarations Declarations and private variables for the CIPAddressInput class.
Height Property Get the height of the ipaddress control.
hWnd Property Get the handle of the ipaddress control (only valid if the Create function has been called).
hWndParent Property Get the handle of the parent window (only valid if the Create function has been called).
IPAddress Property Get the IP address in the control.
Left Property Get the left position of the ipaddress control, relative to the parent window.
Top Property Get the top position of the ipaddress control, relative to the parent window.
Width Property Get the width of the ipaddress control.
Class_Terminate Terminate Release resources used by the class.
Clear Method Clear the contents of the control.
Create Method Create the IP address picker control. This procedure should only be called after the hWndParent, Left, Top, Width, and Height properties are set.
Destroy Method Destroy the window that we created. It is not necessary to call this procedure. The Terminate event of this class destroys the window.
IPToLong Method Convert an IP address to a long integer, treating the integer as though it were unsigned.
For example, the following assignment, lngNumber = -1, assigns -1 to the variable lngNumber.
However, this assignment lngNumber = IntToLong(-1), assigns 65,535 to lngNumber.
IsBlank Method Determine whether or not the contents of the control are empty.
LongToIP Method Convert a long integer value to an IP address string.
UpdatePosition Method Update the control's left, top, width and height properties. This is useful if you want to change the size or position of the control after it has been created. The position is determined by the Left, Top, Width, and Height properties.
dblToLong Private Perform an unsigned conversion from a double value to a long integer value. This function correctly handles doubles greater than 2,147,483,647 and less than or equal to 4,294,967,295.
HiByte Private Get the high byte of the passed integer.
HiWord Private Get the high integer of the passed long integer.
IntToLong Private Convert an integer value to a long integer, treating the integer as unsigned.
LoByte Private Get the low byte of the passed integer.
LongToInt Private Perform an unsigned conversion from a long integer to an integer.
LoWord Private Get the low integer of the passed long integer.
MakeInt Private Combine two bytes into an integer.
MakeLong Private Combine two words (integers) into a long integer. This routine correctly handles negative input values.
' Example of CIPAddressInput
' To try this example, do the following:
' 1. Create a new form
' 2. Add a command button 'cmdGetIP'
' 3. Add a command button 'cmdSetIP'
' 4. Add a text box 'txtIPAddress'
' 5. Paste all the code from this example to the new form's module.
' 6. Run the form

Private mIPAddress As CIPAddressInput

Private Sub cmdSetIP_Click()
  mIPAddress.IPAddress = txtIPAddress
End Sub

Private Sub Form_Load()
  'ensure that form is created

  ' Instantiate the three example controls
  Set mIPAddress = New CIPAddressInput

  ' Set properties prior to creating the controls
  With mIPAddress
    .Left = 20
    .Top = 20
    .Height = 22
    .Width = 120
    .hWndParent = Me.hWnd
    .IPAddress = 16778057
  End With

  cmdGetIP.Caption = "Get IP"
  cmdSetIP.Caption = "Set IP"
  txtIPAddress = 16778057

End Sub

Private Sub cmdGetIP_Click()

  MsgBox "The IP Address is : " & mIPAddress.IPAddress
End Sub

Total Visual SourceBook The source code in Total Visual Sourcebook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Total Visual SourceBook is written for the needs of a developer using a source code library covering the many challenges you face. Countless developers over the years have told us they learned some or much of their development skills and tricks from our code. You can too!

Additional Resources

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2016, 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office and VB6

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!

View all FMS products for Microsoft Access All Our Microsoft Access Products


Reader Choice Award for MS Access Source Code Library
Reader Choice

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

SourceBook Info

Additional Info




Free Product Catalog from FMS