AfxBeginThread(listenThread, NULL);

解决方案 »

  1.   

    楼上可以说的详细点吗?
    或者贴段代码
    因为我要用的是Dig一起来,就一直在监听(就是用listenThread)这个函数
      

  2.   

    AfxBeginThread((AFX_THREADPROC)listenThread,NULL);
    AfxBeginThread(listenThread,NULL);
    用了,不行
    rror C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'void (void *)'
    Error executing cl.exe.
      

  3.   

    AfxBeginThread(listenThread,(void*)NULL);
      

  4.   

    你把你的cDlg指针传下去。
    AfxBeginThread(listenThread, this,NULL,NULL,NULL,NULL);然后线程里
    cDlg *m_dlg=(cDlg *)params;
    m_dlg->listenThread();
      

  5.   

    看错了,不好意思,我还以为listenThread你是在线程里用到,原来这个就是线程函数。
      

  6.   

    listenThread就是那个线程函数
    AfxBeginThread(listenThread,(void*)NULL);还是不行
      

  7.   

    AfxBeginThread(你的函数不带括号,任意32位或者主窗口句柄,NULL);还有你的线程函数为UINT X(p````忘记了){}线程函数不能为静态!
      

  8.   

    AfxBeginThread(listenThread, NULL,NULL,NULL,NULL,NULL); 
      

  9.   

    error C2440: 'type cast' : cannot convert from '' to 'unsigned int (__cdecl *)(void *)'
    None of the functions with this name in scope match the target type不行,是我那个函数的参数问题吗?
    郁闷,我太菜了~~。
      

  10.   

    UINT cDlg::listenThread(void * params)
    这样去定义你的函数
      

  11.   

    static UINT cDlg::listenThread(LPVOID params)如果在cDlg类外面用
    AfxBeginThread(cDlg::listenThread, NULL);
    如果在cDlg类里面用
    AfxBeginThread(listenThread, NULL);
      

  12.   

    我先在
    Dlg.h 中
    private:
    UINT listenThread(LPVOID  params);
    Dlg.cpp中写了
    UINT CPoiDlg::listenThread(LPVOID  params)
    {
      ......
    }
    然后在启动的地方写了(都注了,都跑过了)
    //AfxBeginThread((AFX_THREADPROC)listeninThread,NULL);
    //AfxBeginThread(listenThread, NULL,NULL,NULL,NULL,NULL);
    //AfxBeginThread(listeninThread,NULL);
    各位的方法,我都试了下,还是有这个错
    error C2440: 'type cast' : cannot convert from '' to 'unsigned int (__cdecl *)(void *)'
            None of the functions with this name in scope match the target type就是跑不过,真的很郁闷,到底是什么问题
      

  13.   

    我先在
    Dlg.h 中
    private:
    UINT listenThread(LPVOID  params);
    Dlg.cpp中写了
    UINT CPoiDlg::listenThread(LPVOID  params)
    {
      ......
    }
    然后在启动的地方写了(都注了,都跑过了)
    //AfxBeginThread((AFX_THREADPROC)listeninThread,NULL);
    //AfxBeginThread(listenThread, NULL,NULL,NULL,NULL,NULL);
    //AfxBeginThread(listeninThread,NULL);
    各位的方法,我都试了下,还是有这个错
    error C2440: 'type cast' : cannot convert from '' to 'unsigned int (__cdecl *)(void *)'
            None of the functions with this name in scope match the target type就是跑不过,真的很郁闷,到底是什么问题
      

  14.   

    listeninThread 在程序是改过的,函数名都对,贴上来的时候贴多了,都是listenThread
    应该是参数的问题。
      

  15.   

    要unsigned int (__cdecl *)(void *) 这样的函数才行。你看,这是个函数的指针。AfxBeginThread传入的第一个参数是函数指针。你的成员函数肯定不满足这样的定义了。你把你的成员函数换成全局的试试,就可以了。
    UINT CPoiDlg::listenThread(LPVOID  params) //改成UNIT listenThread(LPVOID params)
      

  16.   

    CPoiDlg::CPoiDlg::CPoiDlg::CPoiDlg::CPoiDlg::CPoiDlg::CPoiDlg::不要!