example:
HANDLE hThread;
hThread=CreateThread(NULL,0,LPTHREAD_START_ROUTINE("类成员函数"),0,0,NULL);
WaitForSingleObject(hThread,INFINITE);
    请问怎么解决????

解决方案 »

  1.   

    CreateThread(() takes a function pointer,
    in C++ class, a normal method would require passing
    'this' pointer which is done by the compiler. only static
    methods do not require that. 解决方法, 试着将开线程用的成员函数该为回调函数试试。
      

  2.   

    ServerPort = Port;
    PersistenceTO = PersTO; InitializeCriticalSection(&cs);
    InitializeCriticalSection(&_cs);

    Reset();

    ThreadLaunchedEvent = CreateEvent(NULL, FALSE, TRUE, NULL);
    ResetEvent(ThreadLaunchedEvent);
    ThreadA = (HANDLE)_beginthreadex(NULL, 0, AcceptThread, this, 0, &ThreadA_ID);
    if(!ThreadA)
    {
    LogMessage(LOGFILENAME, "_beginthreadex(...) failure, for Launch Thread", "Run", errno);
    return FALSE;
    }