Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windows Shell
Shell Reference
Shell Functions
 SHSetUnreadMailCount Function
SHSetUnreadMailCount Function

Stores the current user's unread message count for a specified e-mail account in the registry.

Syntax

HRESULT SHSetUnreadMailCount(      
    LPCTSTR pszMailAddress,     DWORD dwCount,     LPCTSTR pszShellExecuteCommand );

Parameters

pszMailAddress
[in] A pointer to a string in Unicode that contains the current user's full e-mail address.
dwCount
[in] The number of unread messages.
pszShellExecuteCommand
[in] A pointer to a string in Unicode that contains the full text of a command that can be passed to ShellExecute. This command should start the e-mail application that owns the account referenced by pszMailAddress.

Return Value

HRESULT, which includes the following possible values.

S_OKThe call completed successfully.
E_OUTOFMEMORYInsufficient memory available.
E_INVALIDARGInvalid string argument in either the pszMailAddress or pszShellExecuteCommand parameters.

Remarks

This function is exported from Shell32.dll in Unicode; there is no ANSI version.

When this function updates the registry, the new registry entry is automatically stamped with the current time and date.

If this function is called by different independent software vendors (ISVs) that specify the same e-mail name, only the last call is saved. That is, calls to this function overwrite any previously saved value for the same e-mail address, even if the calls are made by different ISVs.

It is recommended that the count of unread messages be set only for the main Inbox of the users account. Mail in sub-folders such as Drafts,or Deleted Items should be ignored.

It is important that e-mail clients do not set the number of unread messages to 0 when the application exits, because this causes the number of unread messages to be erroneously reported as 0.

Because this function uses HKEY_CURRENT_USER, it should not be called by a system process impersonating a user.

Function Information

Minimum DLL Versionshell32.dll version 5.60 or later
Custom ImplementationNo
Headershellapi.h
Import libraryshell32.lib
Minimum operating systems Windows XP
UnicodeImplemented as Unicode version.
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker