tasoss
November 8th, 2004, 12:44 PM
Hello. I have some questions about threads.
fooa is a public Cstring.
CString CConnection::conne(void)
{
DATA *md = new DATA;
CWinThread* pThread=AfxBeginThread(ThreadFunc,this);
return fooa;
}
UINT CConnection::ThreadFunc(LPVOID pParam)
{
CConnection *fa=(CConnection *)pParam;//Parama;
..
fa->fooa=ge;
How is it possible to pass references in pParam???
I mean by fa->fooa=ge; I change fooa but the value of fooa remains the same.If I have used refereces I could change the value of fooa and return fooa; would return the correct CString.I know its possible to pass a structure as pParam and process it in ThreadFunc(DATA *md = new DATA;).My question is how can I keep the changes I have made in structures members,from inside ThreadFunc.
Generally how can the thread function return a value? The specific thread I have written connects to a server, gets an html file which is stored in a CString variable. I want ,somehow, to return this CString so it can be processed by another class.
fooa is a public Cstring.
CString CConnection::conne(void)
{
DATA *md = new DATA;
CWinThread* pThread=AfxBeginThread(ThreadFunc,this);
return fooa;
}
UINT CConnection::ThreadFunc(LPVOID pParam)
{
CConnection *fa=(CConnection *)pParam;//Parama;
..
fa->fooa=ge;
How is it possible to pass references in pParam???
I mean by fa->fooa=ge; I change fooa but the value of fooa remains the same.If I have used refereces I could change the value of fooa and return fooa; would return the correct CString.I know its possible to pass a structure as pParam and process it in ThreadFunc(DATA *md = new DATA;).My question is how can I keep the changes I have made in structures members,from inside ThreadFunc.
Generally how can the thread function return a value? The specific thread I have written connects to a server, gets an html file which is stored in a CString variable. I want ,somehow, to return this CString so it can be processed by another class.