Re: How to wrap a thread?
Jack wrote:
AfxBeginThread((AFX_THREADPROC)Thread_Factory::Manage_Dis, (LPVOID)0,
NULL);
One thing here: If you need these casts to make the code compile, you are
only telling the compiler to shut up and you are not fixing the code. The
resulting binary will still be broken, only that now it come to bite you at
runtime. Avoid casts. Especially, do not use C-style casts.
error C2440: 'type cast' : cannot convert from 'overloaded-function'
to 'AFX_THREADPROC'
If you want to take the address of a specific overload of a function, you
need to use a static_cast to the according type on the overload's address.
One of the very few places a cast is necessary.
Then, there is the problem with a function not being the same as a
memberfunction, for which I suggest you read the C++ FAQ.
One last thing: trim your code. You could have demonstrated the problem in
20 lines of code at most. You posted ten times as much. Reducing it to the
core is also a good start in understanding the problem yourself.
Uli
--
C++ FAQ: http://parashift.com/c++-faq-lite
Sator Laser GmbH
Gesch?ftsf?hrer: Thorsten F?cking, Amtsgericht Hamburg HR B62 932