SHQueryUserNotificationState function (shellapi.h)

Checks the state of the computer for the current user to determine whether sending a notification is appropriate.

Syntax

SHSTDAPI SHQueryUserNotificationState(
  [out] QUERY_USER_NOTIFICATION_STATE *pquns
);

Parameters

[out] pquns

Type: QUERY_USER_NOTIFICATION_STATE*

When this function returns, contains a pointer to one of the values of the QUERY_USER_NOTIFICATION_STATE enumeration.

Return value

Type: HRESULT

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

Remarks

Applications should call SHQueryUserNotificationState and test the return value before displaying any notification UI that is similar to the balloon notifications generated by Shell_NotifyIcon. Notifications should only be displayed if this API returns QNS_ACCEPTS_NOTIFICATIONS. This informs the application whether the user is running processes that should not be interrupted. Top-level windows receive a WM_SETTINGCHANGE message when the user turns presentation settings on or off, and also when the user's session is locked or unlocked. Note that there are no notifications sent when the user starts or stops a full-screen application.

If this function returns QUNS_QUIET_TIME, notifications should be displayed only if critical.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header shellapi.h
DLL Shell32.dll
API set ext-ms-win-shell-shell32-l1-2-0 (introduced in Windows 8.1)