SHNOTIFICATIONDATA
A version of this page is also available for
4/8/2010
This structure contains icon notification data.
Syntax
typedef struct _SHNOTIFICATIONDATA{
DWORD cbStruct;
DWORD dwID;
SHNP npPriority;
DWORD csDuration;
HICON hicon;
DWORD grfFlags;
CLSID clsid;
HWND hwndSink;
LPCTSTR pszHTML;
LPCTSTR pszTitle;
LPARAM lParam;
union
{
SOFTKEYMENU skm;
SOFTKEYNOTIFY rgskn[NOTIF_NUM_SOFTKEYS];
}
LPCTSTR pszTodaySK;
LPCTSTR pszTodayExec;
} SHNOTIFICATIONDATA;
Members
- cbStruct
Size of the structure, in bytes, used for verification and versioning.
- dwID
Identifier for this particular notification.
- npPriority
Priority for the notification, given by the SHNP enumeration.
- csDuration
Duration of the notification. The usage depends on the value of npPriority. Time is in seconds. A value of -1 indicates infinite duration; that is, the notification remains until the user dismisses it, for example, with required user input keystrokes.
- hicon
Handle to the icon for the notification.
grfFlags
Determines which members in the structure are valid or active. The following table shows the possible flag values.Flag Description SHNF_ALERTONUPDATE
Physical alerts are replayed when there is an update to the notification.
SHNF_CRITICAL
The border and title of the notification are highlighted.
SHNF_DISPLAYON
The display is forced to turn on for the notification.
SHNF_FORCEMESSAGE
The notification is forced to display, regardless of Settings.
SHNF_HASMENU
The softkey bar is created from an HMENU passed in skm structure.
SHNF_SHNF_SPINNERS
The notification can be stacked.
SHNF_SILENT
The notification is forced to be silent and not vibrate, regardless of Settings.
SHNF_STRAIGHTTOTRAY
The notification is not displayed when it is initially added. The icon will display for csDuration seconds and will then go straight to the tray. The user can view the icon to see the notification by opening the tray.
SHNF_TITLETIME
The current time is displayed with the notification title.
SHNF_WANTVKTTALK
- clsid
- hwndSink
Handle to the window to receive command choices, dismiss, and so on.
- pszHTML
HTML content for the notification bubble.
- pszTitle
String that contains the optional title for notification bubble.
- lParam
User-defined parameter.
- skm
SOFTKEYMENU structure that defines a menu for the softkey bar for the notification. The grfFlags member must be set to SHNF_HASMENU if this union type is used.
- rgskn
SOFTKEYNOTIFY structure that defines a menu for the softkey bar for the notification, and defines two softkeys.
- pszTodaySK
String that contains the text to display on the Home screen for the SK1 softkey. If this string is set to NULL, the default text "Notification" will be displayed.
- pszTodayExec
Pointer to the executable that will run when the SK1 softkey is pressed. If this pointer is set to NULL, the toast will be displayed.
Remarks
For Windows Mobile if the value of grfFlags member is set to SHNF_WANTVKTTALK, and the sink window is a dialog, it must use DWL_MSGRESULT to return the value.
The following code can be added to the sink window's WndProc function to handle the forwarded message.
case WM_NOTIFY:
switch(wParam)
{
case my_dwID: // the dwID passed into SHNOTIFICATIONDATA when calling SHNotificationAdd
{
NMSHN* pnmshn = (NMSHN*)lParam;
if (pnmshn->hdr.code == SHNN_HOTKEY)
{
if (HIWORD(pnmshn->lParam) == VK_TTALK)
{
//insert code here to handle VK_TTALK
//only need to call SetWindowLong if the sinkwindow is a dialog
SetWindowLong(hWnd, DWL_MSGRESULT, 1);
//return TRUE to inform the Shell that the button was handled
return TRUE;
}
}
break;
}
}
break;
The calling application that owns pszHTML, pszTitle, pszTodaySK, pszTodayExec, and skm or rskn must also free the memory when it returns. The following code example illustrates this concept.
void FreeNotificationData(SHNOTIFICATIONDATA * pnd)
{
LocalFree((HLOCAL)pnd->pszHTML);
LocalFree((HLOCAL)pnd->pszTitle);
LocalFree((HLOCAL)pnd->pszTodaySK);
LocalFree((HLOCAL)pnd->pszTodayExec);
if (pnd->grfFlags & SHNF_HASMENU)
{
LocalFree((HLOCAL)pnd->skm.prgskc);
}
else
{
LocalFree((HLOCAL)pnd->rgskn[0].pszTitle);
LocalFree((HLOCAL)pnd->rgskn[1].pszTitle);
}
}
Requirements
Header | aygshell.h |
Library | aygshell.lib |
Windows Embedded CE | Windows Embedded CE 6.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |