Thank you very much Shabbir, but I have tried this solution already.
I made a Dialog class's member function that exploits the dialog's control.
And worte another non-member function for calling this member one.
The code is as follows.......
CWinThread *pThread = AfxBeginThread(MyThread ,(LPVOID)this) ;
UINT MyThread (LPVOID parameter) /*It is a non-member function*/
CThreadImplementationDlg *handle = static_cast<CThreadImplementationDlg*>(parameter);
handle->InternalFunc (); /*This calls member function successfully*/
void CThreadImplementationDlg ::InternalFunc ()
/* Member Function that exploits the Dialog's control*/
m_label_info = "Thread is Running with count value";
When control reaches the InternalFunc(), an assertion error occurs.
error description is as follows.
Debug Assertion Failed!
Program: ThreadImplementation\Debug\ThreadImplementation.ex e
For information on how your program can cause an assertion failure, see the visual C++ documentation on asserts.
Now the wincore.cpp at line no. 889 says the following.
ASSERT((CWnd*)p == this); // must be us
// Note: if either of the above asserts fire and you are
// writing a multithreaded application, it is likely that
// you have passed a C++ object from one thread to another
// and have used that object in a way that was not intended.
// (only simple inline wrapper functions should be used)
// In general, CWnd objects should be passed by HWND from
// one thread to another. The receiving thread can wrap
// the HWND with a CWnd object by using CWnd::FromHandle.
// It is dangerous to pass C++ objects from one thread to
// another, unless the objects are designed to be used in
// such a manner.
Plz help me as what I am doing, does not seems to be legal/valid or a good programming practice.
Also I am unable to sum up what wincore.cpp is saying as I know a very little about threads.
Thanks in advance.