Microsoft KB Archive/176060

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

Article ID: 176060

Article Last Modified on 8/18/2005

-

APPLIES TO


 * Microsoft Messaging Application Programming Interface
 * Microsoft Collaboration Data Objects 1.1

-



This article was previously published under Q176060



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 Download Center:

Download Showform.exe now

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. ******************************************************************* 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 its 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

