Επεξεργασία

Κοινή χρήση μέσω


ISyncMgrSyncItem::GetName method (syncmgr.h)

Gets the UI display name of the sync item.

Syntax

HRESULT GetName(
  [out] LPWSTR *ppszName
);

Parameters

[out] ppszName

Type: LPWSTR*

When this method returns, contains a pointer to a buffer containing the item's display name. This string is of maximum length MAX_SYNCMGR_NAME including the terminating null character. Longer strings are truncated.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

If GetName fails or an empty string is returned in ppszItemID, the sync item is not shown in the handler's folder and Sync Center will not attempt to synchronize it.

The ID retrieved by this method is available in the handler's folder UI as the System.DisplayName (PKEY_DisplayName) property.

The item is responsible for allocating the string buffer pointed to by ppszComment through CoTaskMemAlloc. Sync Center deallocates the string buffer through CoTaskMemFree.

Sync Center calls this method whenever the UpdateItem method is called.

In older Sync Manager implementations, this information was retrieved through the SYNCMGRHANDLERINFO structure.

Examples

The following example shows an implementation of this method.

STDMETHODIMP CMyDeviceSyncItem::GetName(__out LPWSTR *ppszName)
{
    *ppszName = NULL;
    HRESULT hr = SHCoAllocString(_pszItemName, ppszName);
    return hr;
}

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header syncmgr.h