Multithreading 使用AfxBeginthread传递GlobalInterface指针
我正在CDialog类中使用工作线程Multithreading 使用AfxBeginthread传递GlobalInterface指针,multithreading,visual-c++,com,marshalling,Multithreading,Visual C++,Com,Marshalling,我正在CDialog类中使用工作线程 theApp.m_pWorkerThread = AfxBeginThread(Threadproc,this); 现在我需要将全局Inerface poiner传递给工作线程,以便从外部访问COM对象 有人能告诉我传递GIT cookie并在线程中访问它的语法吗 谢谢好吧,我自己来回答 实际上,这可以通过三种方式实现。我将简要介绍一种方式 使用atlbase.h中的CComGitPtr 这样做: CComGitPtr 指向已初始化的 接口 现在从DWO
theApp.m_pWorkerThread = AfxBeginThread(Threadproc,this);
现在我需要将全局Inerface poiner传递给工作线程,以便从外部访问COM对象
有人能告诉我传递GIT cookie并在线程中访问它的语法吗
谢谢好吧,我自己来回答 实际上,这可以通过三种方式实现。我将简要介绍一种方式 使用atlbase.h中的CComGitPtr 这样做: CComGitPtr 指向已初始化的 接口 现在从DWORD dwCokie=gitprname->Detach中提取cookie 现在,将cookie作为structoptional的内容传递到工作线程中 进入工作线程后,提取cookie,调用CoInitilize,并实例化Requiired接口指针 作为一名共产党员,我需要做好准备 现在将git cookie传递给GI表并检索封送的COM对象 比如: 谢谢
// This is done inide the thread
// retrieve the passed cookie as dwCookie
CComGITPtr<COMInterfacethatneedMarshalling
Now we have pToGITTest inside the thread, fully marshalled, go ahead and enjoy!