static函数好像可以,不过最好不要这样.
可以用
AfxBeginThread((AFX_THREADPROC)ImportThread,
LPVOID(this), THREAD_PRIORITY_NORMAL, 0, 0, NULL);UINT ImportThread(LPVOID pParam)
{
CYourClass *pyourclass;
LONG lResult; pyourclass = (CYourClass *)(pParam);
......

解决方案 »

  1.   

    线程函数和CALLBACK函数如果要作为类的成员函数来使用
    必须声明为static
      

  2.   

    void CWatchFile::StartWatch()
    {
    if(!ScanFileList())
    {
    AfxMessageBox("扫描被监视文件列表失败");
    return;
    }
    IsWatching=FALSE;
    AfxBeginThread(CWatchFile::BeginWatch,this);
    return ;
    }UINT CWatchFile::BeginWatch(LPVOID pParem)
    {
    CWatchFile* p=(CWatchFile*)pParem;

    typListFName *pList_fName=&(p->m_ListFileName);
    CString strFname(_T(""));
    for(;;)
    {
    if(pList_fName->IsEmpty())
    return 0;


    POSITION pos=pList_fName->GetHeadPosition();
    for(int i=0;i<pList_fName->GetCount();i++)
    {
    strFname.Empty();
    strFname=pList_fName->GetNext(pos);

    p->AnalyseListFile(strFname);
    }

    if(p->IsWatching) break;
    Sleep(600);
    }

    return 1;
    }
      

  3.   

    // WatchFile.h: interface for the CWatchFile class.
    //
    //////////////////////////////////////////////////////////////////////#if !defined(AFX_WATCHFILE_H__25AE2706_1B70_4019_8358_6B72334FD1DC__INCLUDED_)
    #define AFX_WATCHFILE_H__25AE2706_1B70_4019_8358_6B72334FD1DC__INCLUDED_#if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    typedef CList<CString,CString&>  typListFName;class CWatchFile  
    {
    public:
    void StopWatch(); typListFName * GetWatched_fNameList(); void SetListFileName(typListFName & ListFName);
    void SetListFileName(CString strFName);
    CWatchFile();
    virtual ~CWatchFile();
    void StartWatch();protected:
    BOOL IsWatching; void AddWatched_FileName(CString fName);
    BOOL AnalyseListFile(CString fName);
    typedef struct tagFileInf
    {
    CString fName;
    CTime fMTime;

    } _FILEINF;
    typedef CList<_FILEINF,_FILEINF&> typListFileInf; BOOL GetFileLast_mTime(CString FileName);
    BOOL ScanFileList();
    static UINT BeginWatch(LPVOID pParem);
    typListFName m_ListWatched_fName; //记录已监视到的文件List
    typListFName m_ListFileName; //保存被监视的文件List
    typListFileInf m_List_fInf; //保存文件最后一次修改时间的List};#endif // !defined(AFX_WATCHFILE_H__25AE2706_1B70_4019_8358_6B72334FD1DC__INCLUDED_)
      

  4.   

    静态可以,但是不能访问该类的成员变量。
    不知你这样做的目的,如果想让一个线程访问类的成员变量的话,可以把线程函数说明为该类的friend。