// MyIPAddressCtrl.cpp : implementation file // #include "stdafx.h" #include "dicommwl.h" #include "MyIPAddressCtrl.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMyIPAddressCtrl CMyIPAddressCtrl::CMyIPAddressCtrl() { } CMyIPAddressCtrl::~CMyIPAddressCtrl() { } BEGIN_MESSAGE_MAP(CMyIPAddressCtrl, CIPAddressCtrl) //{{AFX_MSG_MAP(CMyIPAddressCtrl) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMyIPAddressCtrl message handlers CString CMyIPAddressCtrl::IPtoString() { CString csIP=""; DWORD dwAddr=0; struct sockaddr_in sockAddrIn; GetAddress(dwAddr); sockAddrIn.sin_addr.s_addr = ntohl(dwAddr); csIP = inet_ntoa(sockAddrIn.sin_addr); return csIP; } CString CMyIPAddressCtrl::IPtoString(DWORD lAddress) { CString csIP=""; struct sockaddr_in sockAddrIn; sockAddrIn.sin_addr.s_addr = ntohl(lAddress); csIP = inet_ntoa(sockAddrIn.sin_addr); return csIP; }