FILE: Showform.exe Displays Message in its Own Form with VB

ID: Q176060

The information in this article applies to:

SUMMARY

Showform.exe provides a dynamic-link library (DLL) containing a function that can be called from Visual Basic allowing you to display a message from an Active Messaging session in its own form.

MORE INFORMATION

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

 ~ Showform.exe (size: 83032 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

******************************************************************* SHOWFORM Sample *******************************************************************

Purpose

Files

The Showform.exe contains the following files:

Note that the project and workspace files were created in Microsoft Visual C++ version 5.0.

How to Use

The following is sample Visual Basic code that you can use to call the ShowForm function in the sample DLL. Be sure to check "Microsoft Active Messaging 1.1 Object Library" in the References dialog box from the Project menu.

    ' Place this code in the General declarations of the main module
    ' of your project.

     Public Declare Function ShowForm _
        Lib "c:\mapitest\showform\debug\showform.dll" _
        Alias "showform" (ByVal ProfileName As String, _
                          ByVal MsgID As String, _
                          ByVal FolderID As String, _
                          ByVal StoreID As String, _
                          ByVal hWnd As Long) _
        As Integer

    ' Place this code in the Click event of a CommandButton on a
    ' form in your project.

    Dim bRet As Integer
    Dim oSession As Object
    Dim oMsg As Object

    ' Create a MAPI Session.

    Set oSession = CreateObject("MAPI.Session")
    If oSession Is Nothing Then
        MsgBox "Could not create Mapi Session", vbOKOnly, "VBSendRTF"
        End
    End If

    ' Logon to the Session.
    oSession.Logon

    ' Locate the first message in the Inbox.
    ' NOTE: You could insert code here to locate the specific message
    ' that you want to view.
    Set oMsg = oSession.Inbox.Messages.GetFirst

    ' You must call the Update method of the message object in order
    ' to obtain the actual Entry IDs associated with the message.
    oMsg.Update

    'Show the Message Form.
    bRet = ShowForm(oSession.Name, oMsg.ID, oMsg.FolderID, _
                    oMsg.StoreID, hWnd)

    If Not bRet = 0 Then
        MsgBox "Show Form Failed with error: " & Hex$(bRet), _
               vbOKOnly, "VBShowForm Warning"
    End If

REFERENCES

For additional sample Extended MAPI code, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q170601
   TITLE     : HOWTO: Displaying the Compose IPM.Note Form

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)

Additional query words: PrepareForm
Keywords          : kbcode kbfile kbCDO kbCDO110 kbMAPI kbMsg kbMAPI100 
Version           : WINDOWS:1.0,1.1
Platform          : WINDOWS

Last Reviewed: March 16, 1999