FILE: Showform.exe: Display Message in it's Own Form with VB

Last reviewed: November 21, 1997
Article ID: Q176060
The information in this article applies to:
  • Extended Messaging Application Programming Interface (MAPI), version 1.0
  • Collaboration Data Objects (CDO), version 1.1

SUMMARY

The download file 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 it's own form.

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

MORE INFORMATION

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

Purpose

  • Provide a DLL function that may be called from a Visual Basic application that is using Active Messaging.
  • Provide a sample of Extended MAPI code illustrating how to display a message in it's own form.

Files

The Showform.exe contains the following files:

  • Readme.txt - contains general information about this sample
  • Showform.dll - release version of the sample DLL
  • Showformd.dll - debug version of the sample DLL
  • Main.cpp - source file for the DLL
  • Main.h - header file for the DLL
  • Showform.def - definition file for DLL Exports
  • Showform.dsp - project file for the sample
  • Showform.dsw - workspace file for the sample

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 ActMsg EMAPI
Version : WINDOWS:1.0,1.1
Platform : WINDOWS
Issue type : kbfile


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 21, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.