我想用多线程的方式来实现这个实时显示,可是显示error C2673: 'Fun1Proc' : global functions do not have 'this' pointers      error C2660: 'GetClientRect' : function does not take 1 parameters等等。附上部分程序,谢谢大神指教
DWORD WINAPI Fun1Proc(
  LPVOID lpParameter   // thread data
);DWORD WINAPI Fun2Proc(
  LPVOID lpParameter   // thread data
);DWORD WINAPI Fun3Proc(
  LPVOID lpParameter   // thread data
);void CXxView::OnTimer(UINT nIDEvent) 
{
int k=0;
    

CView::OnTimer(nIDEvent);
}DWORD WINAPI Fun1Proc(
  LPVOID lpParameter   // thread data
)
{    int k=0;
    CRect rc;
CClientDC dc(this);
GetClientRect(&rc);    x1[0]=410;y1[0]=594;
dc.MoveTo(x[j],y[j]);
x1[j+1]=410+15*(j+1);
y1[j+1]=594-(int)getad(i1)*13;
dc.LineTo(x1[j+1],y1[j+1]);
j++;


if(j%31==0)
{
RedrawWindow();
j=j%30;
}
return 0;
}

解决方案 »

  1.   

    你应该在开启线程的时候将this指针作为参数传进线程
      

  2.   

    例如
    AfxBeginThread(Fun1Proc, this);然后在Fun1Proc中
    CXxView* pView = (CXxView*) lpParameter;
    这样你就能通过pView访问CXxView类中的对象啦
      

  3.   

    那AfxBeginThread(Fun1Proc, this);
    应该加在哪儿呢?谢谢
      

  4.   

    你的你的View中启动线程的时候
      

  5.   

    'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'unsigned long (__stdcall *)(void *)'
      

  6.   

    CClientDC dc(this);
    这句有问题。this是主线程才有的。你的工作线程不能直接使用。