Passage of MFC object parameters in multi-threaded

xiaoxiao2021-03-06  83

Today, the needs of the program, in the thread downloading the data, to make changes to the text of the status bar to display the download status. I started writing this: void setStatustext (CSTRING STR) {

CMAINFRAME * PFRAME; PFRAME = (cmainframe *) AFXGETMAINWND (); pframe-> m_wndstatus bar.setpanltext (1, str);} I actually found that I can't get M_WndStatusbar handle, the M_Wnd has always been ????? or 0xffffFFF So I have not been successful. Later, I thought of SendMessage's way void setStatustext (CString str) {

CMAINFRAME * PFRAME; Pframe = (cmainframe *) AFXGETMAINWND (); pframe-> sendMessage (wm_set_text, (uint) & str, 0);

} Add message mapping and processing functions in CMAINFRAME

Long CMAINFRAME :: setStatustext (uint l, long p) {cstring * str = (cstring *) L; m_wndstatus bar.SetPanetext (1, * str); return 0;} Together, everything is done

转载请注明原文地址:https://www.9cbs.com/read-102088.html

New Post(0)