今天看一篇介绍套间的文章,感觉写得很清晰。http://www.vckbase.com/document/viewdoc/?id=1597不过其中说,在一个线程中(主线程)在创建线程时候,把在主线程得到的组件接口指针传递给另一个线程,这个做法是不正确的。这个是为什么呢?然后我自己做了个实验,发现实验中的地址并未发生改变。不知原因,向大家请教了!
// thread func
DWORD WINAPI ThreadProc(LPVOID lpParam)
{
    int *b = reinterpret_cast<int*>(lpParam);
    printf("In Thread, The Address of the parameter is: %p \nand the value is: %d\n", b, *b);    return 0;
}int main(void)
{
    int  a = 5;
    DWORD dwThreadID = -1;
    printf("in main, the address of parameter is : %p\n", &a);
    HANDLE hThread = ::CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc, (LPVOID)&a, 0, &dwThreadID);    if (hThread == NULL)
    {
        std::cout << "CreateThread failed!" << endl;
        return 0;
    }
    else
    {
        ::WaitForSingleObject(hThread, INFINITE);
    }    return 0;
}