IContactManagerInterop::ShowContactCardForWindow method (shobjidl_core.h)

Displays the UI for a contact on the specified window.

Syntax

HRESULT ShowContactCardForWindow(
  [in] HWND             appWindow,
  [in] IUnknown         *contact,
  [in] const RECT       *selection,
  [in] FLYOUT_PLACEMENT preferredPlacement
);

Parameters

[in] appWindow

Type: HWND

The HWND of the foreground window of the app from which the contact card is launched and where focus is returned when the contact card is dismissed.

[in] contact

Type: IUnknown*

A pointer to the contact object. Use a Windows.ApplicationModel.Contacts.Contact object but cast to IUnknown here because classic COM IDL can't use Windows Runtime types.

[in] selection

Type: RECT const*

The Rect is the rectangular area of user selection (for example, pressing a button), around which the operating system displays the contact card, not within that rectangular area. For example, if an app uses a button to show the contact card, pass the Rect of the button so the contact card displays around the button, not overlapping it.

[in] preferredPlacement

Type: FLYOUT_PLACEMENT

A FLYOUT_PLACEMENT-typed value that describes the preferred placement of the contact card.

Value Meaning
FP_DEFAULT
0
Use the default.
FP_ABOVE
1
Prefer to place the contact card above the rectangular area of user selection specified by the selection parameter.
FP_BELOW
2
Prefer to place the contact card below the rectangular area of user selection specified by the selection parameter.
FP_LEFT
3
Prefer to place the contact card to the left of the rectangular area of user selection specified by the selection parameter.
FP_RIGHT
4
Prefer to place the contact card to the right of the rectangular area of user selection specified by the selection parameter.

Return value

Type: HRESULT

ShowContactCardForWindow returns:

  • S_OK if the contact card is successfully displayed
  • E_POINTER if appWindow is NULL or contact is NULL or selection is NULL
  • E_INVALIDARG if contact isn't a Windows.ApplicationModel.Contacts.Contact object or preferredPlacement is an invalid enumeration value
Other HRESULT values are possible.

Requirements

Requirement Value
Minimum supported client Windows 8.1 [desktop apps only]
Minimum supported server Windows Server 2012 R2 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h

See also

IContactManagerInterop

ShowContactCardForWindow