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_OK | The call completed successfully. |
| E_OUTOFMEMORY | Insufficient memory available. |
| E_INVALIDARG | Invalid 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 Version | shell32.dll version 5.60 or later |
|---|
| Custom Implementation | No |
|---|
| Header | shellapi.h |
|---|
| Import library | shell32.lib |
|---|
| Minimum operating systems |
Windows XP |
|---|
| Unicode | Implemented as
Unicode version. |
|---|