If you have the handle to the dialog, you can simply use a SendMessage() call and return the handle cast as an LRESULT.
Using pseudo-code:
#define MSG_GETHANDLE (WM_APP+1)
BEGIN_MESSAGE_MAP( TargetDialog, CDialog )
ON_MESSAGE( MSG_GETHANDLE, OnGetHandle)
END_MESSAGE_MAP()
LRESULT TargetDialog::OnGetHandle(WPARAM,LPARAM)
{
...
return (LRESULT) handleTextBox;
}
CEdit *textbox = (CEdit *)TargetDialog->SendMessage(MSG_GETHANDLE,0,0);
I should say however, that it can be considered bad practice to write directly to another dialog's internal controls. A better method would be to send a request for data or for a change in the GUI and let the parent dialog change the controls.