我想添加一个线程,用来判断数据,代码如下UINT CMy1Dlg::judge(LPVOID pParam)
                                                {
                                                   if((m_a.GetCurSel()==0)
                                              {
                                                    int a=1;
                            int b=2;
                                   }
                                                 }这样定义可以吗?
如果可以的话  那LPVOID pParam怎么办?我在pThread=AfxBeginThread(judgedatebiaoshi, ??)的问号处该怎么写呢?谢谢

解决方案 »

  1.   

    this->GetSafeWnd()就可以了,
    不可以的话再说,还有其他的方法
      

  2.   

    声明为静态static UINT   judge(LPVOID   pParam)
    ??=NULL
      

  3.   

    UINT   CMy1Dlg::judge(LPVOID   pParam) 

    CMy1Dlg *pThis;
    pThis = (CMy1Dlg*)pParam;

    if((pThis->m_a.GetCurSel()==0) 

    int   a=1; 
    int   b=2; 

    ...线程函数使用类成员函数要用静态的, this指针需要传递
    pThread=AfxBeginThread(judgedatebiaoshi,   this)
      

  4.   

    不需要传递参数的话写NULL,需要的话就传递参数,以指针形式