熟悉com和c#看过来,用IStream传输数据,第三贴了
现在准备在c#边传输文件到com,通过IStream   
 class   MyIStream   :   MemoryStream,   IStream 
 { 
                         public   MyIStream() 
                                     :   base() 
                         {                                       
                         } 
                         #region   IStream   成员   
                         public   void   Clone(out   IStream   ppstm) 
                         { 
                                     throw   new   Exception( "The   method   or   operation   is   not   implemented. "); 
                         }   
                         public   void   Commit(int   grfCommitFlags) 
                         { 
                                     throw   new   Exception( "The   method   or   operation   is   not   implemented. "); 
                         }   
                         public   void   CopyTo(IStream   pstm,   long   cb,   IntPtr   pcbRead,   IntPtr   pcbWritten) 
                         { 
                                     throw   new   Exception( "The   method   or   operation   is   not   implemented. "); 
                         }   
                         public   void   LockRegion(long   libOffset,   long   cb,   int   dwLockType) 
                         { 
                                     throw   new   Exception( "The   method   or   operation   is   not   implemented. "); 
                         }   
                         public   void   Read(byte[]   pv,   int   cb,   IntPtr   pcbRead) 
                         { 
                                     long   bytesRead   =   Read(pv,   0,   cb); 
                                     if   (pcbRead   !=   IntPtr.Zero) 
                                                 Marshal.WriteInt64(pcbRead,   bytesRead); 
                         }   
                         public   void   Revert() 
                         { 
                                     throw   new   Exception( "The   method   or   operation   is   not   implemented. ");