FILE: DLL to Read and Write RTF with Active Messaging

ID: Q172038

The information in this article applies to:

SUMMARY

When writing an Active Messaging client, it would be useful to be able to use rich text formatting (RTF) in the body of the messages that are created. However, the Active Messaging Libraries provide access only to the plain text version of the body of the message, giving no control over the font characteristics of the message body.

This sample contains a DLL with functions that may be called from an Active Messaging client to read and write RTF text of a message.

The following file is available for download from the Microsoft Software Library:

 ~ Mapirtf.exe (size: 109180 bytes) 

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119591
   TITLE     : How to Obtain Microsoft Support Files from Online Services

MORE INFORMATION

Below are the contents of the Readme.txt file for this sample.

MAPIRTF Sample

This sample illustrates how use Extended MAPI to allow RTF-formatting in a message created by Active Messaging.

Files

The self-extracting executable, Mapirtf.exe, contains the following files:

General

The files Mapirtf.dll (release version) and Mapirtfd.dll (debug version) contain the following functions:

How to Use

Before use, the DLL files should be placed in the Windows\System directory (for Windows 95) or the Winnt\System32 directory (for Windows NT.

In Visual Basic, declare the functions as follows:

    ' For the Debug version of the DLL, remark the following lines
    Public Declare Function writertf _
        Lib "mapirtf.dll" _
                         (ByVal ProfileName As String, _
                          ByVal MessageID As String, _
                          ByVal StoreID As String, _
                          ByVal cText As String) _
        As Integer

    Public Declare Function readrtf _
        Lib "mapirtf.dll" _
                      (ByVal ProfileName As String, _
                       ByVal SrcMsgID As String, _
                       ByVal SrcStoreID As String, _
                       ByRef MsgRTF As String) _
        As Integer

    ' For the Debug version of the DLL, un-remark the following lines
    'Public Declare Function writertf _
        Lib "mapirtfd.dll" _
                         (ByVal ProfileName As String, _
                          ByVal MessageID As String, _
                          ByVal StoreID As String, _
                          ByVal cText As String) _
        As Integer

    'Public Declare Function readrtf _
        Lib "mapirtfd.dll" _
                      (ByVal ProfileName As String, _
                       ByVal SrcMsgID As String, _
                       ByVal SrcStoreID As String, _
                       ByRef MsgRTF As String) _
        As Integer

Sample Code

The following sample code assumes that you have already declared the DLL function as described above. For a more complete example, please see the Visual Basic project accompanying this sample.

REFERENCES

For additional information about Collaboration Data Objects versus Active Messaging, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q176916
   TITLE     : INFO: Active Messaging and Collaboration Data Objects (CDO)

Keywords          : kbcode kbfile kbsample kbActMsg kbMsg kbMAPI100 
Version           : WINDOWS:1.0,1.1,1.21
Platform          : WINDOWS

Last Reviewed: May 26, 1999