Loading a Message Into a Form

To load an existing message into a form using a form server, use one of the following strategies.

Using the PrepareForm and ShowForm strategy is comparatively easy, but it results in forms that are modal with respect to your client. This is because the call to ShowForm does not return until the form has exited. If you need to handle forms asynchronously, do not use this strategy.

Using the LoadForm strategy is more difficult because the method requires several parameters. These parameters instruct the form manager to launch the proper form server in the proper context and display the proper message. If the form server is already running, the form manager loads the message into the form server without launching a new instance of the form server.

To specify which form server to launch, pass the message class handled by the target server in the contents of the lpszMessageClass parameter. The appropriate message class can be determined by retrieving the PR_MESSAGE_CLASS property of the message to be loaded. Sometimes there is no form server for the specified message class, only a form server that handles messages belonging to the message's superclass. If you prefer that the message be loaded only by a form server specifically meant to handle messages of that class, set the MAPIFORM_EXACTMATCH flag in the LoadForm call. For more information, see Message Classes.

LoadForm also requires a pointer to your viewer's message site and view context and the value for the target message's PR_MSG_STATUS and PR_MESSAGE_FLAGS properties.