WinAPI EM_STREAMOUT crash
问题 I'm trying to get the text of a Richedit Control from another program. So I found EM_STREAMOUT for SendMessage. This is my code so far (also from another Stackoverflow topic): DWORD CALLBACK EditStreamOutCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb) { std::stringstream *rtf = (std::stringstream*) dwCookie; rtf->write((char*)pbBuff, cb); *pcb = cb; return 0; } int main() { std::stringstream rtf; EDITSTREAM es = {0}; es.dwCookie = (DWORD_PTR) &rtf; es.pfnCallback =