这个问题很好解决。要做 A 中获取 B 的内容,那就需要在 A 中保存 B 的对象或指针,如下:在 A 类中定义一个指针,指向 Bpublic: CBDlg * pBDlg; pBDlg = new CBDlg; pBDlg->Create(... 然后,只要 B 对话框没有关闭,就可以直接读取了,如下:CString str; pBDlg->GetDltItemText(IDC_EDIT, str);
只要类的对象还有生命,它的Public成员是可以访问的
SendMessage( (HWND) hWnd, // handle to destination window WM_GETTEXT, // message to send (WPARAM) wParam, // number of characters to copy (LPARAM) lParam // text buffer ); wParam Specifies the maximum number of TCHARs to be copied, including the terminating null character. Windows NT/2000/XP: ANSI applications may have the string in the buffer reduced in size (to a minimum of half that of the wParam value) due to conversion from ANSI to Unicode. lParam Pointer to the buffer that is to receive the text.
这个问题很好解决。要做 A 中获取 B 的内容,那就需要在 A 中保存 B 的对象或指针,如下:在 A 类中定义一个指针,指向 Bpublic:
CBDlg * pBDlg;
pBDlg = new CBDlg;
pBDlg->Create(...
然后,只要 B 对话框没有关闭,就可以直接读取了,如下:CString str;
pBDlg->GetDltItemText(IDC_EDIT, str);
SendMessage(
(HWND) hWnd, // handle to destination window
WM_GETTEXT, // message to send
(WPARAM) wParam, // number of characters to copy
(LPARAM) lParam // text buffer
);
wParam
Specifies the maximum number of TCHARs to be copied, including the terminating null character.
Windows NT/2000/XP: ANSI applications may have the string in the buffer reduced in size (to a minimum of half that of the wParam value) due to conversion from ANSI to Unicode. lParam
Pointer to the buffer that is to receive the text.