Timo and Frankie,
Many thanks to both of you for assisting me - again :-)
This is the best support forum I have used in the last 15 years.
Timo,
I almost got it working with your 1st method.
Actually have the it working to transfer the text, but I can't quit the application.
When I click the OK button, nothing happens.
As I understand it ....
So in the WM_INITDIALOG, i get the Handle to the IDOK item number, using,
g_OK = GetDlgItem(hwndDlg, IDOK);
Then when the IDOK signal comes along, I test to see if it came from my Edit box
or not, using,
if (GetFocus()== g_OK) EndDialog(hwndDlg, TRUE);
So if it did come from the OK (closing) Button
then GetFocus() will equal g_OK
then I quit the app,
otherwise GetFocus() is for my Edit box,
and I do something else.
Not sure why it does not work ... but it doesn't matter.
I did indeed get your second way to work in all respects.
It's cool since I have not used GetDlgCtrlID() before and now I have a new tool.
Here is what I ended up with:
case IDOK:
iCtlId = GetDlgCtrlID(GetFocus());
if (iCtlId == IDOK)
{
EndDialog(hwndDlg, TRUE);
return TRUE;
}
else
{
// Get the text to send from the edit box 4001
Edit_GetText(GetDlgItem(hwndDlg,4001), gbuf, gbufmx);
//update the Edit box 4002 with the text from 4001
Edit_SetText(GetDlgItem(hwndDlg,4002), gbuf);
return TRUE;
}
} //end switch (GET_WM_COMMAND_ID(wParam, lParam))
Again, many thanks to you and Frankie.
Best regards,
Rob