http://www.codeproject.com/Articles/1651/Tutorial-Modeless-Dialogs-with-MFC
The title is modeless but there's alot of info and comparisons to modal dialogs that I found helpful...
It's not hard, but it takes a lot of jumping around the code at first until u see how it's all connected. Maybe create a side project just to experiment with this ?
That's MFC, if you want clean WINAPI, get ResEdit and create your Dialog with a IP Address Control, and a OK button, then change your Window Message Handler for the appropriate use.
Sorry to reopen the topic but I'm finding it difficult to get the IP as a char * from the ip address control. I know I have to use IPM_GETADDRESS, but I'm not sure how to use it.
Ho, you should use it like: sprintf(buf, "%d.%d.%d.%d",(int)IP[0],(int)IP[1],(int)IP[2],(int)IP[3]);
And for safety reasons, use snprintf like: snprintf(buf,100,......)
And if it says it's 0... IDK, are you sure you're entering all parameters? Also try checking if SendMessage returns 4.
I decided to go with your plan modoran. Using SendMessage(hWndDlg,WM_GETTEXT,sizeof(buffer)/sizeof(buffer[0]),reinterpret_cast<LPARAM>(buffer));
apparantly returns "enter server ip" which is the caption on the dialog box. How to I specify to get the text from the edit control?
// With the IP Control:
HWND IP_Control = GetDlgItem(hWndDlg, (ID of your IP Control like IDC_IPCTRL1) );
SendMessage(IP_Control,...);
// With the EditBox Control:
HWND Edit_Control = GetDlgItem(hWndDlg, (ID of your EditBox Control like IDC_EDIT1) );
SendMessage(Edit_Control,...);
You see, you're trying to get the IP address from your Main Window, and not from the IP Control!