Click to See Complete Forum and Search --> : Re: CreateThread ---- BIG problem - URGENT


Alvaro
March 28th, 1999, 01:38 PM
You need to do two things:


1. Make sure your CProgramView::ThreadProc function is declared as a static member of your CProgramView class. Note that once you make it static, you won't have a "this" pointer so you'll need to access your object some other way. I recommend you pass it as a parameter inside the CreateThread function (see below).


2. Call CreateThread like this:


CreateThread(...., (LPTHREAD_START_ROUTINE)CProgramView::ThreadProc, this);


This tells it to use the static CProgramView::ThreadProc function and passes it the "this" pointer as the LPVOID parameter which you can then use to access the object.


Good luck!