need help with windows IP Control box

I am trying to bring user entered data in to my program using a windows IP control box.
I am using the following code from examples others have used but I get the error "cannot use four arguments" when I look it up on MSVN website it asks for four arguments. Any suggestions? Is there a better way to do this.


DWORD CurAddress;

LRESULT SM = SendMessage(IDC_IPADDRESS1, IPM_GETADDRESS, 0, (LPARAM)(LPDWORD)&CurAddress);
m_strIPtext5 = FIRST_IPADDRESS((LPARAM)CurAddress);
m_strIPtext6 = SECOND_IPADDRESS((LPARAM)CurAddress);
m_strIPtext7 = THIRD_IPADDRESS((LPARAM)CurAddress);
m_strIPtext8 = FOURTH_IPADDRESS((LPARAM)CurAddress);
By any chance do you use MFC?
The SendMessage you posted is the Win Api method which requires 4 parameters.
MFC controls(CWnd) also have a SendMessage function which only takes 3 parameters.
Thank you. How do I find MFC specific functions. I am really having a hard time on me MSVN knowing what is what. Yes using MFC
Thank you
This is what I have come up with but when I run it It does not seem to populate the fields, any thoughts?



void CTestINIDlg::OnIpnFieldchangedIpaddress1(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMIPADDRESS pIPAddr = reinterpret_cast<LPNMIPADDRESS>(pNMHDR);
// TODO: Add your control notification handler code here

int GetAddress(
BYTE& F0,
BYTE& F1,
BYTE& F2,
BYTE& F3
);

*pResult = 0;


m_strIP1 = F2;
}
I am not sure what you want to do.

To set the value of the control you can use:
1
2
CString IPAddress (_T ("255.125.25"));
m_IP.SetWindowText (IPAddress);

or
1
2
BYTE b1 = 255, b2= 111, b3=123, b4 = 122;
m_IP.SetAddress (b1, b2, b3, b4);

To get the value from the control you use:
1
2
BYTE b1, b2, b3, b4;
m_IP.GetAddress (b1, b2, b3 ,b4);

or
1
2
3
CString Buffer;
m_IP.GetWindowText (Buffer);
AfxMessageBox (Buffer);


The doc for the control: https://msdn.microsoft.com/en-us/library/596yzwbb.aspx

An enhanced control:
http://www.codeproject.com/Articles/9234/XIPAddressCtrl-an-enhanced-IP-address-control-base
Last edited on
I am starting to figure out that I have a class problem. If I try to use m_strIP1 which has been declared it tells me I need a class. Been doing a refresher on classes and declarations, it is slowly making more sense just need to put it all together.
Topic archived. No new replies allowed.