线程函数跟创建线程

线程函数和创建线程
刚学这个 不懂额。然后看书自己写 有些地方错误的。

    DWORD WINAPI ThreadFunc(LPVOID lpParameter)
    {
        for(int i=1;i<=100000;i++)
        {
            Form1->label1->Caption = i;
        }
    }
    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
        int hHandle;
        DWORD threadID;
        hHandle = (int)CreateThread(NULL, 0, ThreadFunc, (void*)this, 0, &threadID);
        if(hHandle == 0)
        {
                MessageBox(Handle, "没有线程", NULL, MB_OK);
        }
    }

这样为什么错的哦 谁帮我看看哦

还有TFormThreadSample是个什么类 干嘛
------最佳解决方案--------------------
该回复于2011-07-01 10:58:34被版主删除
------其他解决方案--------------------
我知道了 不能写成成员函数。。我想结贴  没人回复么
------其他解决方案--------------------
....
------其他解决方案--------------------
BCB有自己的一个线程类,很好用的

class EnThread : public TThread
{
private:
        string iFile,oFile;
        TAes* _aes;             
        bool Encrypt;   
protected:
        void __fastcall Execute();
public:
        __fastcall EnThread(TAes* aes,const string& in,const string& out,bool En,bool CreateSuspended=true)
                : TThread(CreateSuspended)
        {
                iFile=in;
                oFile=out;
                _aes=aes;
                Encrypt=En;
        }
};

void __fastcall TForm1::ButtonEnClick(TObject *Sender)
{
        this->SetKey();
        TAes* aes = new TAes(this->keysize,this->key);
        this->InfoAes = aes;
        EnThread* En= new EnThread(aes,this->InFileStr,this->OutFileStr,this->Encry,true);
        this->Timer1->Enabled =true;