what to do?
Code:
UINT recv_thd (LPVOID p)
{
Int res;
Char MSG [1024].
CString s;
=(CCFileDlg *) AfxGetApp CCFileDlg * DLG () - & gt; GetMainWnd ();
DLG - & gt; The update (" in THD ");
While (1)
{
If ((res=recv (sock, MSG, 1024, 0))==1)
{
DLG - & gt; The update (" lost connection ");
break;
}
The else
{
MSG (res)='\ 0';
//MSG (res)=0;
DLG - & gt; The update (" server: "+ cstrings (MSG));
////////////////////////////////////////////add//
Cstrings data;
Data=https://bbs.csdn.net/topics/msg;
Cstrings str1;
Cstrings str2;
Cstrings str3;
Cstrings str4;
Cstrings str5;
Cstrings machine_num;
AfxExtractSubString (machine_num, data, 0, '#');
AfxExtractSubString (str1, data, 1, '#');
AfxExtractSubString (str2, data, 2, '#');
AfxExtractSubString (str3, data, and 3, '#');
AfxExtractSubString (str4, data, 4, '#');
AfxExtractSubString (str5, data, 5, '#');
If (machine_num=="m1")
{
DLG - & gt; M1_zhuansu=str1;
DLG - & gt; M1_qiansheng=str2;
DLG - & gt; M1_niandu=str3;
DLG - & gt; M1_dingchang=str4;
DLG - & gt; M1_chanliang=str5;
}
DLG - & gt; The UpdateData (false);
}
}
//closesocket (sock);
return 0;
}
CodePudding user response:
Use the A2T (), A2W () function transformationCodePudding user response:
Threads want to send a message to display window, do not call directlyCodePudding user response:
PostMessage way to send data to the main thread, and only the main thread can be used to update the UICodePudding user response:
The