CIPAddressCtrl

CIPAddressCtrl

Post by Anon » Wed, 24 Sep 2003 14:45:37


In the following code my edit box which is supposed to display an IP
address always displays the number "4". I can't figure out why it
won't work. Any suggestions are more than welcome.

void CIPGetAddressDlg::OnRunme()
{
// TODO: Add your control notification handler code here
DWORD DwordAddress=0;
char CharAddress[100];
CIPAddressCtrl *ipaddressctrl = (CIPAddressCtrl *)
GetDlgItem(IDC_IPADDRESSCTRL);
CEdit *edit = (CEdit *) GetDlgItem(IDC_EDIT);
DwordAddress = ipaddressctrl->GetAddress(DwordAddress);
sprintf(CharAddress,"%d",DwordAddress);
edit->SetWindowText(CharAddress);
}

Thank you.
 
 
 

CIPAddressCtrl

Post by Scott McPh » Wed, 24 Sep 2003 21:30:07


GetAddress returns the number of fields in the control: the 4 you are
getting. The address is returned in the parameter. Try:

int n = ipaddressctrl->GetAddress(DwordAddress);

--
Scott McPhillips [VC++ MVP]