2012-10-30 46 views

回答

1

它在那裏,聯合被平化爲IntPtr類型的簡單單個字段。你可以只投它:

#include <windows.h> 

using namespace System::Runtime::InteropServices; 

    //... 
    ComTypes::STGMEDIUM foo; 
    IStorage* pStore = (IStorage*)foo.unionmember.ToPointer(); 

或者,如果你願意,你可以當元帥的整個結構:

::STGMEDIUM native; 
Marshal::StructureToPtr(foo, IntPtr(&native), false); 
IStorage* pStore = native.pstg; 
+0

很好的工作! –