IFilter, IPersistStream, IStream

  • Thread starter Thread starter Ilya Potekhin
  • Start date Start date
I

Ilya Potekhin

Hi All,

I create Com Interop for IPersistStream, IFilter and wrap for IStream.
----------------------------------------------------------------------------
-
[ComImport, Guid("00000109-0000-0000-C000-000000000046")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPersistStream : IPersist
{
new void GetClassID(out Guid pClassID);

[PreserveSig]
int IsDirty( );
void Load([In] UCOMIStream pStm);
void Save([In] UCOMIStream pStm, [In, MarshalAs(UnmanagedType.Bool)] bool
fClearDirty);
void GetSizeMax(out long pcbSize);
}
----------------------------------------------------------------------------
-----
[ComImport, Guid("89BCB740-6119-101A-BCB7-00DD010655AF")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IFilter : IPersistStream
{
[PreserveSig]
IFilterReturnCodes Init(
[MarshalAs(UnmanagedType.U4)]
IFILTER_INIT grfFlags,
int cAttributes,
IntPtr aAttributes,
[MarshalAs(UnmanagedType.U4)]
ref IFILTER_FLAGS pdwFlags);
[PreserveSig]
IFilterReturnCodes GetChunk(
ref STAT_CHUNK pStat
);
[PreserveSig]
IFilterReturnCodes GetText(ref int pcwcBuffer,[Out(),
MarshalAs(UnmanagedType.LPWStr)]
StringBuilder awcBuffer
);
[PreserveSig]
IFilterReturnCodes GetValue(IntPtr ppPropValue);
}
--------------------------------------------------------


When I run this code I getting this Exception ("QueryInterface for interface
ISDocParser.IPersistStream failed.").

UCOMStreamWrapper istream = new UCOMStreamWrapper(stream);
IPersistStream ipf=(IPersistStream)Filter;
ipf.Load((UCOMIStream)istream); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Can you help me with my problem?

Thanks
 
Back
Top