description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: CIPAddressCtrl Class |
CIPAddressCtrl Class |
11/04/2016 |
|
|
9764d2f4-cb14-4ba8-b799-7f57a55a47c6 |
Provides the functionality of the Windows common IP Address control.
class CIPAddressCtrl : public CWnd
Name | Description |
---|---|
CIPAddressCtrl::CIPAddressCtrl | Constructs a CIPAddressCtrl object. |
Name | Description |
---|---|
CIPAddressCtrl::ClearAddress | Clears the contents of the IP Address Control. |
CIPAddressCtrl::Create | Creates an IP Address Control and attaches it to a CIPAddressCtrl object. |
CIPAddressCtrl::CreateEx | Creates an IP Address control with the specified Windows extended styles and attaches it to a CIPAddressCtrl object. |
CIPAddressCtrl::GetAddress | Retrieves the address values for all four fields in the IP Address Control. |
CIPAddressCtrl::IsBlank | Determines if all fields in the IP Address Control are empty. |
CIPAddressCtrl::SetAddress | Sets the address values for all four fields in the IP Address Control. |
CIPAddressCtrl::SetFieldFocus | Sets the keyboard focus to the specified field in the IP Address Control. |
CIPAddressCtrl::SetFieldRange | Sets the range in the specified field in the IP Address Control. |
An IP Address control, a control similar to an edit control, allows you to enter and manipulate a numerical address in Internet Protocol (IP) format.
This control (and therefore the CIPAddressCtrl
class) is available only to programs running under Microsoft Internet Explorer 4.0 and later. They will also be available under future versions of Windows and Windows NT.
For more general information about the IP Address Control, see IP Address Controls in the Windows SDK.
CIPAddressCtrl
Header: afxcmn.h
Creates a CIPAddressCtrl
object.
CIPAddressCtrl();
Clears the contents of the IP Address Control.
void ClearAddress();
This member function implements the behavior of the Win32 message IPM_CLEARADDRESS, as described in the Windows SDK.
Creates an IP Address Control and attaches it to a CIPAddressCtrl
object.
virtual BOOL Create(
DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd,
UINT nID);
dwStyle
The IP Address control's style. Apply a combination of window styles. You must include the WS_CHILD style because the control must be a child window. See CreateWindow in the Windows SDK for a list of windows styles.
rect
A reference to the IP Address Control's size and position. It can be either a CRect object or a RECT structure.
pParentWnd
A pointer to the IP Address Control's parent window. It must not be NULL.
nID
The IP Address Control's ID.
Nonzero if initialization was successful; otherwise 0.
You construct a CIPAddressCtrl
object in two steps.
-
Call the constructor, which creates the
CIPAddressCtrl
object. -
Call
Create
, which creates the IP Address Control.
If you want to use extended windows styles with your control, call CreateEx instead of Create
.
Call this function to create a control (a child window) and associate it with the CIPAddressCtrl
object.
virtual BOOL CreateEx(
DWORD dwExStyle,
DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd,
UINT nID);
dwExStyle
Specifies the extended style of the control being created. For a list of extended Windows styles, see the dwExStyle parameter for CreateWindowEx in the Windows SDK.
dwStyle
The IP Address control's style. Apply a combination of window styles. You must include the WS_CHILD style because the control must be a child window. See CreateWindow in the Windows SDK for a list of windows styles.
rect
A reference to a RECT structure describing the size and position of the window to be created, in client coordinates of pParentWnd.
pParentWnd
A pointer to the window that is the control's parent.
nID
The control's child-window ID.
Nonzero if successful; otherwise 0.
Use CreateEx
instead of Create to apply extended Windows styles, specified by the Windows extended style preface WS_EX_.
Retrieves the address values for all four fields in the IP Address Control.
int GetAddress(
BYTE& nField0,
BYTE& nField1,
BYTE& nField2,
BYTE& nField3);
int GetAddress(DWORD& dwAddress);
nField0
A reference to the field 0 value from a packed IP address.
nField1
A reference to the field 1 value from a packed IP address.
nField2
A reference to the field 2 value from a packed IP address.
nField3
A reference to the field 3 value from a packed IP address.
dwAddress
A reference to the address of a DWORD value that receives the IP address. See Remarks for a table that shows how dwAddress is filled.
The number of non-blank fields in the IP Address Control.
This member function implements the behavior of the Win32 message IPM_GETADDRESS, as described in the Windows SDK. In the first prototype above, the numbers in fields 0 through 3 of the control, read left to right respectively, populate the four parameters. In the second prototype above, dwAddress is populated as follows.
Field | Bits containing the field value |
---|---|
0 | 24 through 31 |
1 | 16 through 23 |
2 | 8 through 15 |
3 | 0 through 7 |
Determines if all fields in the IP Address Control are empty.
BOOL IsBlank() const;
Nonzero if all of the IP Address Control fields are empty; otherwise 0.
This member function implements the behavior of the Win32 message IPM_ISBLANK, as described in the Windows SDK.
Sets the address values for all four fields in the IP Address Control.
void SetAddress(
BYTE nField0,
BYTE nField1,
BYTE nField2,
BYTE nField3);
void SetAddress(DWORD dwAddress);
nField0
The field 0 value from a packed IP address.
nField1
The field 1 value from a packed IP address.
nField2
The field 2 value from a packed IP address.
nField3
The field 3 value from a packed IP address.
dwAddress
A DWORD value that contains the new IP address. See Remarks for a table that shows how the DWORD value is filled.
This member function implements the behavior of the Win32 message IPM_SETADDRESS, as described in the Windows SDK. In the first prototype above, the numbers in fields 0 through 3 of the control, read left to right respectively, populate the four parameters. In the second prototype above, dwAddress is populated as follows.
Field | Bits containing the field value |
---|---|
0 | 24 through 31 |
1 | 16 through 23 |
2 | 8 through 15 |
3 | 0 through 7 |
Sets the keyboard focus to the specified field in the IP Address Control.
void SetFieldFocus(WORD nField);
nField
Zero-based field index to which the focus should be set. If this value is greater than the number of fields, focus is set to the first blank field. If all fields are non-blank, focus is set to the first field.
This member function implements the behavior of the Win32 message IPM_SETFOCUS, as described in the Windows SDK.
Sets the range in the specified field in the IP Address Control.
void SetFieldRange(
int nField,
BYTE nLower,
BYTE nUpper);
nField
Zero-based field index to which the range will be applied.
nLower
A reference to an integer receiving the lower limit of the specified field in this IP Address Control.
nUpper
A reference to an integer receiving the upper limit of the specified field in this IP Address Control.
This member function implements the behavior of the Win32 message IPM_SETRANGE, as described in the Windows SDK. Use the two parameters, nLower and nUpper, to indicate the lower and upper limits of the field, instead of the wRange parameter used with the Win32 message.