Last modified: July 23, 2011

Applies to: Outlook

Opens a form to create a new message based on the form's message class.

HRESULT CreateForm(
  ULONG_PTR ulUIParam,
  ULONG ulFlags,
  IMAPIFormInfo pfrminfoToActivate,
  REFIID refiidToAsk,
  LPVOID FAR * ppvObj


[in] A handle to the parent window for the progress indicator that is displayed while the form is opened. The ulUIParam parameter is ignored unless the MAPI_DIALOG flag is set in the ulFlags parameter.


[in] A bitmask of flags that controls how the form is opened. The following flag can be set:


Displays a user interface to provide status or prompt the user for more information. If this flag is not set, no user interface is displayed.


[in] A pointer to the form information object that is used to open the form.


[in] A pointer to the interface identifier (IID) for the interface to be returned for the form object that was created. The refiidToAsk parameter must not be NULL.


[out] A pointer to a pointer to the returned interface.


The call succeeded and has returned the expected value or values.


The requested interface is not supported by the form object.

Form viewers call the IMAPIFormMgr::CreateForm method to open a form to create a new message based on the form's message class. CreateForm opens the form by creating an instance of the form server for that form as described in the given form information object. If required, CreateForm calls the IMAPIFormMgr::PrepareForm method to download the form server code to the user's disk.

The pfrminfoToActivate parameter must point to a form information object that has been correctly resolved.

After the form has been opened, the calling form viewer must set up a message by using the IPersistMessage interface and can optionally set up a view context for the form. For more information, see Launching a Form Server.

For MFCMAPI sample code, see the following table.






MFCMAPI uses the IMAPIFormMgr::CreateForm method to create a form before displaying it.