Sending the IPM_CLEARADDRESS message to an IP Address control clears its contents.
The message does not return a meaningful value.
None.
Const IPM_CLEARADDRESS = &H464
When the form loads, create an IP Address control and place it in the upper-left corner of the window. When the user clicks button cmdClear, the contents of the IP Address control are erased.
To use this example, create a command button named cmdClear and place it on a form window. The IP Address control will be created programmatically when the program starts.
' This code is licensed according to the terms and conditions listed here. ' Declarations and such needed for the example: ' (Copy them to the (declarations) section of a module.) Public Type INITCOMMONCONTROLSEX_TYPE dwSize As Long dwICC As Long End Type Public Declare Function InitCommonControlsEx Lib "comctl32.dll" (lpInitCtrls As _ INITCOMMONCONTROLSEX_TYPE) As Long Public Const ICC_INTERNET_CLASSES = &H800 Public Declare Function CreateWindowEx Lib "user32.dll" Alias "CreateWindowExA" (ByVal dwExStyle As Long, _ ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x _ As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, _ ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long Public Const WC_IPADDRESS = "SysIPAddress32" Public Const WS_CHILD = &H40000000 Public Const WS_VISIBLE = &H10000000 Public Declare Function DestroyWindow Lib "user32.dll" (ByVal hWnd As Long) As Long Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal Msg _ As Long, wParam As Any, lParam As Any) As Long Public Const IPM_CLEARADDRESS = &H464 ' *** Place the following code inside the form window. *** Private hIPControl As Long ' handle to the IP Address control ' When the form is initialized, create an IP Address control in the ' upper-left corner of the form. Private Sub Form_Initialize() Dim comctls As INITCOMMONCONTROLSEX_TYPE ' identifies the control to register Dim retval As Long ' generic return value ' Register the IP Address control window class. With comctls .dwSize = Len(comctls) .dwICC = ICC_INTERNET_CLASSES End With retval = InitCommonControlsEx(comctls) ' Create the IP Address control in the corner of the window. hIPControl = CreateWindowEx(0, WC_IPADDRESS, "", WS_CHILD Or WS_VISIBLE, 0, 0, 125, 20, _ Me.hWnd, 0, App.hInstance, ByVal CLng(0)) End Sub ' Destroy the IP Address control when the form closes. Private Sub Form_Unload(Cancel As Integer) Dim retval As Long ' return value retval = DestroyWindow(hIPControl) End Sub ' Clear the contents of the IP Address control when the ' use clicks this button. Private Sub cmdClear_Click() Dim retval As Long retval = SendMessage(hIPControl, IPM_CLEARADDRESS, ByVal CLng(0), ByVal CLng(0)) End Sub
IPM_GETADDRESS, IPM_SETADDRESS
IP Address Control
Back to the Message 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/i/ipm_clearaddress.html