-
Threads problem
Ok I am getting sleepy and I can't see the code for all letters. I am trying to run a thread but I get a compiler error
Code:
UINT CBarjorCadCamView::CreatePointMenu(LPVOID pParam)
{
CBarjorCadCamView* pObject = (CBarjorCadCamView*pParam;
if (pObject == NULL ||
!pObject->IsKindOf(RUNTIME_CLASS(CBarjorCadCamView)))
return 1; // if pObject is not valid
// do something with 'pObject'
return 0; // thread completed successfully
}
//And I call it like this
void CBarjorCadCamView::OnTest()
{
CBarjorCadCamView*pNewObject = new CBarjorCadCamView;
AfxBeginThread(CreatePointMenu, pNewObject);
}
The error I get is
F:\My Programs\InProgres\BarjorCadCam\BarjorCadCamView.c pp(2826) : error C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'unsigned int (void *)'
Do I have to start the thread in another class then View?
Can the "thread function" be in the ViewClass?
So I am stuck . Any help would be so great and I would gladly give my old keyboard as a reward, well maybe not.
-
In your class declaration, declare the thread func like so;
Code:
static UINT CreatePointMenu(LPVOID pParam);
or in your code detail the function as a non class member;
Code:
UINT CreatePointMenu(LPVOID pParam);
That sould work, you can keep the keyboard.......
-
Worked like a charm. Thanks alot..Mm no keyboard..How about a Govtcheez doll in fair shape?