// Define the istream which stores marshalled interface pointer
IStream* iStream;
IStream* iStream;
// Marshal the pointer in one thread
hResult = CoMarshalInterThreadInterfaceInStream (__uuidof(InterfaceClass), spInterfacePointer, &iStream);
hResult = CoMarshalInterThreadInterfaceInStream (__uuidof(InterfaceClass), spInterfacePointer, &iStream);
// Unmarshal and get the interface pointer in another thread
hResult = CoGetInterfaceAndReleaseStream (iStream, __uuidof(InterfaceClass), (void**)&spInterfacePointer);
hResult = CoGetInterfaceAndReleaseStream (iStream, __uuidof(InterfaceClass), (void**)&spInterfacePointer);
转载于:https://blog.51cto.com/yongkai/305086
本文详细介绍了如何在多线程环境中使用Co调用接口进行串行化与反串行化操作,包括如何在不同线程间传递接口指针并实现数据交换。
5441

被折叠的 条评论
为什么被折叠?



