[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

DouglasWoods

8/14/2007 4:12:00 AM

I am accessing a COM object from C#. The COM object has a IPersistStreamInit
interface which I want to use.

Is the IPersistStreamInit defined in the .NET Framework? I couldn't find it
in system.runtime.interopservices. I have searched and found C# code that
has code like

Interop.IPersistStreamInit psi =
(Interop.IPersistStreamInit)_site.MSHTMLDocument;

http://www.koders.com/csharp/fid3C1586372712141DB6359918187BCEFCEF0F3F97.aspx?s=IPersist...

But I cannot work out where IPersistStreamInit is defined.

Can anyone point direct me out of this maze?
--
Douglas Woods
2 Answers

(Mattias Sjögren)

8/14/2007 6:59:00 AM

0


>Is the IPersistStreamInit defined in the .NET Framework? I couldn't find it
>in system.runtime.interopservices. I have searched and found C# code that
>has code like

No it isn't. You have to define it yourself. You can start with
IPersistStream from here

http://www.pinvoke.net/default.aspx/Interfaces/IPersistS...

and then add the IPersistStreamInit methods.


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.n... | http://www.dotneti...
Please reply only to the newsgroup.

mehr13

8/15/2007 11:54:00 PM

0

On Aug 13, 8:12 pm, DouglasWoods
<DouglasWo...@discussions.microsoft.com> wrote:
> I am accessing a COM object from C#. The COM object has a IPersistStreamInit
> interface which I want to use.
>
> Is the IPersistStreamInit defined in the .NET Framework? I couldn't find it
> in system.runtime.interopservices. I have searched and found C# code that
> has code like
>
> Interop.IPersistStreamInit psi =
> (Interop.IPersistStreamInit)_site.MSHTMLDocument;
>
> http://www.koders.com/csharp/fid3C1586372712141DB6359918187......
>
> But I cannot work out where IPersistStreamInit is defined.
>
> Can anyone point direct me out of this maze?
> --
> Douglas Woods


//MIDL_INTERFACE("7FD52380-4E07-101B-AE2D-08002B2EC713")
//IPersistStreamInit : public IPersist
//{
//public:
// virtual HRESULT STDMETHODCALLTYPE IsDirty( void) = 0;

// virtual HRESULT STDMETHODCALLTYPE Load(
// /* [in] */ LPSTREAM pStm) = 0;

// virtual HRESULT STDMETHODCALLTYPE Save(
// /* [in] */ LPSTREAM pStm,
// /* [in] */ BOOL fClearDirty) = 0;

// virtual HRESULT STDMETHODCALLTYPE GetSizeMax(
// /* [out] */ ULARGE_INTEGER *pCbSize) = 0;

// virtual HRESULT STDMETHODCALLTYPE InitNew( void) = 0;

//};

[ComVisible(true), ComImport(),
Guid("7FD52380-4E07-101B-AE2D-08002B2EC713"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPersistStreamInit
{
void GetClassID(
[In, Out] ref Guid pClassID);

[return: MarshalAs(UnmanagedType.I4)]
[PreserveSig]
int IsDirty();

[return: MarshalAs(UnmanagedType.I4)]
[PreserveSig]
int Load(
[In, MarshalAs(UnmanagedType.Interface)]
System.Runtime.InteropServices.ComTypes.IStream pstm);

[return: MarshalAs(UnmanagedType.I4)]
[PreserveSig]
int Save(
[In, MarshalAs(UnmanagedType.Interface)]
System.Runtime.InteropServices.ComTypes.IStream pstm,
[In, MarshalAs(UnmanagedType.Bool)] bool fClearDirty);

void GetSizeMax(
[Out, MarshalAs(UnmanagedType.LPArray)] long pcbSize);

[return: MarshalAs(UnmanagedType.I4)]
[PreserveSig]
int InitNew();
}