Hi,
I am using C++ MFC and I wouldn't exactly call myself an expert :-). What I have is a thread drawMonitor which monitors when to draw and I would like it to call DrawLines() (which is a member function in the class) to do the drawing.
void drawMonitor(void *); //this is in the code file
void drawMonitor(void *arg)
{
TCHAR buf[128];
_stprintf(buf, _T("Draw Monitor started\n"));
OutputDebugString(buf);
while (true)
{
if (g_VangleReady)
{
//DrawLines();
g_VangleReady = false;
}
else
Sleep(g_DrawMonitorDelay);
}
_stprintf(buf, _T("Draw Monitor stopped\n"));
OutputDebugString(buf);
}
void CDraw2::DrawLines()
{
//Code here
}
I am starting my thread using
_beginthread(drawMonitor, 0, (void*)12);
This builds and executes ok, but the DrawLines is commented out. When I remove the comments I get the error message: C3861: 'DrawLines': identifier not found. When I attempt to add drawMonitor to the class:
void CDraw2::drawMonitor(void *); //this is in the header file, all else is in the code file
void CDraw2::drawMonitor(void *arg) { /* same code as above but DrawLines is not commented out */ } //in code file
I am now starting my thread using
_beginthread(CDraw2::drawMonitor, 0, (void*)12);
I now get an error message C3867: 'CDraw2::drawMonitor': function call missing argument list; use '&CDraw2::drawMonitor' to create a pointer to member
I am not much a C++ progreammer, but we are trying to throw a demonstrator together which requires the use of C++ MFC. Any help with what I am doing wrong would be much appreciated as I've spent many hours trying to puzzle through this.
Thanks in advance.