From: Lisa Pearlson on 3 Oct 2007 09:42 Hi, I'm having problems using SHNotificationAdd & SHNotificationRemove below. Can someone tell answer the following questions? 1. If I call ShowNotification and RemoveNotification, will I have memory leaks? SHNotificationAdd is passed szMessage, which is local variable and will be destroyed at end of function. So, do I have to save the string buffer or does SHNotificationAdd COPY this to some internal buffer? If not, I must free this buffer myself after the call to SHNotioficationRemove ? 2. The icon is displayed in title bar. I read that it is a bitmask, so my icon is only black on transparent background. But still this icon is shown as black in title bar, and not in the color that is set by theme for iconbar. How can I make it use theme colors? Lisa #define NOTIFICATION_ID 1 BOOL RemoveNotification() { if (!SUCCEEDED(SHNotificationRemove(&CLSID_SHNAPI_OemNotif3, NOTIFICATION_ID))) { OutputDebugString(_T("ERROR: SHNotificationRemove")); return FALSE; } return TRUE; } BOOL ShowNotification(HINSTANCE hInstance, UINT nStringID) { TCHAR szMessage[MAX_LOADSTRING]; if (0 == LoadString(hInstance, nStringID, szMessage, sizeof(szMsg)/sizeof(szMsg[0]))) { return FALSE; } SHNOTIFICATIONDATA sn = {0}; sn.cbStruct = sizeof(sn); sn.dwID = NOTIFICATION_ID; sn.npPriority = SHNP_INFORM; sn.csDuration = 5; sn.hicon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON)); sn.grfFlags = SHNF_FORCEMESSAGE; sn.clsid = CLSID_SHNAPI_OemNotif3; sn.pszTitle = _T("Notofication"); sn.pszHTML = szMessage; if (SUCCEEDED(SHNotificationAdd(&sn))) { return FALSE; } return TRUE; }
|
Pages: 1 Prev: RIL_SendSimCmd in WM6 emulator Next: Windows Mobile 5.0 SDK install error |