m_pThrdFTPTxfr = (CThrdFTPTxfr *)AfxBeginThread
(RUNTIME_CLASS(CThrdFTPTxfr),THREAD_PRIORITY_ABOVE_NORMAL,0,
CREATE_SUSPENDED);
if (m_pThrdFTPTxfr == NULL) {Clog(0,"Error starting 'CThrdFTPTxfr' thread...");
return(FALSE);}这是一个线程的创建吗?那么它有一个参数是RUNTIME_CLASS(CThrdFTPTxfr),这个意思是不是这个线程是运行CThrdFTPTxfr这个类,请解释它的下一步动作,和这个语句的含意?谢谢

解决方案 »

  1.   

    是的,可以这样创建一个线程。
    RUNTIME_CLASS是一个宏,用以返回一个CRuntimeClass结构指针;CRuntimeClass结构是MFC运行时类型识别的东西,而不是说运行CThrdFTPTxfr这个类。
    AfxBeginThread的返回值为一个CWinThread指针,这个指针就是用来操作线程的各种动作的。
      

  2.   

    from msdn:CWinThread* AfxBeginThread( AFX_THREADPROC pfnThreadProc, LPVOID pParam, int nPriority = THREAD_PRIORITY_NORMAL, UINT nStackSize = 0, DWORD dwCreateFlags = 0, LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL );
    CWinThread* AfxBeginThread( CRuntimeClass* pThreadClass, int nPriority = THREAD_PRIORITY_NORMAL, UINT nStackSize = 0, DWORD dwCreateFlags = 0, LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL );pThreadClass:The RUNTIME_CLASS of an object derived from CWinThread.The first form of AfxBeginThread creates a worker thread. The second form creates a user-interface thread.