Link to home
Start Free TrialLog in
Avatar of juliam64
juliam64

asked on

Thread in MFC

I have a simple MFC application which holds one dialog with several controls.
I created a thread and with function wich applies to one of the dialog controls. When I run the program I immidiatly have Assertion Failure.
Here is the code:


static UINT Recieve(LPVOID d)
{
   MainDlg& dobj = *(MainDlg*)d;
   cMessage m;
   int i=1;
   int Status;
   CString tmp = ((char)m.mDestination);
//here it fails:
dobj.m_MessageCntrl.SetWindowText(tmp);
      }
      return 0;
}

Could anybody solve this problem for me
Thanks
ASKER CERTIFIED SOLUTION
Avatar of Vinayak Kumbar
Vinayak Kumbar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Wyn
Wyn



 

Why by reference not by pointer?
What is m.mDestination ?

Try changing it to (char*)(m.mDestination)?

Avatar of juliam64

ASKER

The problem was that I was referrin a dialog in it's constructor, before it was created, it stroke me when I saw
InitDialog,
Thanks
I see.