SHSetUnreadMailCountA function (shellapi.h)
Stores the current user's unread message count for a specified email account in the registry.
HRESULT SHSetUnreadMailCountA( [in] LPCSTR pszMailAddress, DWORD dwCount, [in] LPCSTR pszShellExecuteCommand );
A pointer to a string in Unicode that contains the current user's full email address.
The number of unread messages.
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 email application that owns the account referenced by pszMailAddress.
HRESULT, which includes the following possible values.
||The call completed successfully.|
||Insufficient memory available.|
||Invalid string argument in either the pszMailAddress or pszShellExecuteCommand parameters.|
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 email name, only the last call is saved. That is, calls to this function overwrite any previously saved value for the same email 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 email 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.
|Minimum supported client||Windows XP [desktop apps only]|
|Minimum supported server||Windows Server 2003 [desktop apps only]|
|DLL||Shell32.dll (version 5.60 or later)|