Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Accessing WrapCompressedRichText from C#

42 views
Skip to first unread message

Cory

unread,
May 14, 2010, 12:16:16 PM5/14/10
to
Hello,

I have a few basic questions.

1. Will WrapCompressedRichText take an input stream, then process the data,
then fire out a uncompressed stream?

2. Is there a simple way that someone who does not know much about COM /
p-invoke can convert/pass a string into WrapCompressedRichText and get a
string out? (I know that it expects a stream, but I have not been able to
get it to work with the C# Stream object.

Back ground:

I have written a C# application with Visual Studio 2008.

I have everything working except the part of the application where I am
trying to take data from a string and pass it to the DLLImport call to
MSMapi32.dll for the function WrapCompressedRichText and get a processed
string back. I am more than happy to provide any additional information. I
have been trying to solve this all week.

Here are the two ways I have tried to import the DLL.

***Code Example One***

[DllImport("Mapi32.dll", PreserveSig = true)]
private static extern void
WrapCompressedRTFStream(
[MarshalAs(UnmanagedType.Interface)]
UCOMIStream lpCompressedRTFStream,
uint ulflags,
[MarshalAs(UnmanagedType.Interface)]
out UCOMIStream lpUncompressedRTFStream
);

**End Code Example One***


***Code Example Two***

[DllImport("Msmapi32.dll", PreserveSig = true)]
private static extern void WrapCompressedRTFStream(
[MarshalAs(UnmanagedType.Interface)]
IStream lpCompressedRTFStream,
uint ulflags,
[MarshalAs(UnmanagedType.Interface)]
out IStream lpUncompressedRTFStream
);

***End Code Example Two***


Also both code examples need the following two line. (So I have been told
but I do not know why)

***Needed Code for both Examples ***

public const uint MAPI_MODIFY = 0x00000001;
public const uint STORE_UNCOMPRESSED_RTF = 0x00008000;

***End of Needed Code for both Examples ***


Thank you for your time!
Cory

0 new messages