Notification不显示??

infsafe 2009-08-05 11:00:40
在windows mobile doc6.0中的例子:
static const GUID CLSID_SHNAPI_Test = { 0x33765136, 0x8cb9, 0x449a, { 0xb0, 0x20, 0x43, 0xed, 0x40, 0xa, 0xb8, 0xfc } };
void SHNotificationExample()
{
// This code will add an SHNotification notificaion
SHNOTIFICATIONDATA sn = {0};
SHNOTIFICATIONDATA sn2 = {0};
sn.cbStruct = sizeof(sn);
sn.dwID = 1;
sn.npPriority = SHNP_INFORM;
sn.csDuration = 15;
sn.hicon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SAMPLEICON));
sn.clsid = CLSID_SHNAPI_Test;
sn.grfFlags = 0;
sn.pszTitle = TEXT("Sample Notification");
sn.pszHTML = TEXT("<html><body>This is <b>sample html</b> in a notification!</body></html>");
sn.rgskn[0].pszTitle = TEXT("Dismiss");
sn.rgskn[0].skc.wpCmd = 100;
//Add the notification to the tray

//Put the data from an existing notification into a second SHNOTIFICATIONDATA struct
sn2.cbStruct = sizeof(sn2);
SHNotificationGetData(&CLSID_SHNAPI_Test, 1, &sn2);
//Update the title, HTML, icon, and softkeys of the notification
sn2.pszTitle = TEXT("Updated - Sample Notification");
sn2.pszHTML = TEXT("<html><body>This notification has been <b>updated!</b></body></html>");
sn2.hicon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SAMPLEICON2));
sn2.rgskn[0].pszTitle = TEXT("Disabled");
sn2.rgskn[0].skc.wpCmd = 100;
sn2.rgskn[0].skc.grfFlags = NOTIF_SOFTKEY_FLAGS_DISABLED;
SHNotificationUpdate(SHNUM_TITLE | SHNUM_HTML | SHNUM_ICON | SHNUM_SOFTKEYCMDS | SHNUM_SOFTKEYS, &sn2);
//Remove the notification from the tray
SHNotificationRemove(&CLSID_SHNAPI_Test, 1);
//Add a new notification that utilizes the MRE functionality
sn.cbStruct = sizeof(sn);
sn.dwID = 1;
sn.npPriority = SHNP_INFORM;
sn.csDuration = 15;
sn.hicon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SAMPLEICON));
sn.clsid = CLSID_SHNAPI_Test;
sn.grfFlags = SHNF_STRAIGHTTOTRAY;
sn.pszTodaySK = TEXT("New Task");
sn.pszTodayExec = TEXT("\\windows\\tasks.exe");
//Add the notification to the tray
SHNotificationAdd(&sn);
//Remove the notification from the tray
SHNotificationRemove(&CLSID_SHNAPI_Test, 1);
}
为什么我运行了系统没有任何反应?怎么不显示啊?
...全文
233 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
dqcat 2009-08-05
  • 打赏
  • 举报
回复
//Add the notification to the tray
SHNotificationAdd(&sn);
//Remove the notification from the tray
SHNotificationRemove(&CLSID_SHNAPI_Test, 1);

为啥Add以后又马上Remove呢?
infsafe 2009-08-05
  • 打赏
  • 举报
回复
static const GUID CLSID_SHNAPI_Test = { 0x33765136, 0x8cb9, 0x449a, { 0xb0, 0x20, 0x43, 0xed, 0x40, 0xa, 0xb8, 0xfc } };
void SHNotificationExample()
{
// This code will add an SHNotification notificaion
SHNOTIFICATIONDATA sn = {0};
SHNOTIFICATIONDATA sn2 = {0};
sn.cbStruct = sizeof(sn);
sn.dwID = 1;
sn.npPriority = SHNP_INFORM;
sn.csDuration = 15;
sn.hicon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SAMPLEICON));
sn.clsid = CLSID_SHNAPI_Test;
sn.grfFlags = 0;
sn.pszTitle = TEXT("Sample Notification");
sn.pszHTML = TEXT(" <html> <body>This is <b>sample html </b> in a notification! </body> </html>");
sn.rgskn[0].pszTitle = TEXT("Dismiss");
sn.rgskn[0].skc.wpCmd = 100;
//Add the notification to the tray

//Put the data from an existing notification into a second SHNOTIFICATIONDATA struct
sn2.cbStruct = sizeof(sn2);
SHNotificationGetData(&CLSID_SHNAPI_Test, 1, &sn2);
//Update the title, HTML, icon, and softkeys of the notification
sn2.pszTitle = TEXT("Updated - Sample Notification");
sn2.pszHTML = TEXT(" <html> <body>This notification has been <b>updated! </b> </body> </html>");
sn2.hicon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SAMPLEICON2));
sn2.rgskn[0].pszTitle = TEXT("Disabled");
sn2.rgskn[0].skc.wpCmd = 100;
sn2.rgskn[0].skc.grfFlags = NOTIF_SOFTKEY_FLAGS_DISABLED;
SHNotificationUpdate(SHNUM_TITLE | SHNUM_HTML | SHNUM_ICON | SHNUM_SOFTKEYCMDS | SHNUM_SOFTKEYS, &sn2);
//Remove the notification from the tray
SHNotificationRemove(&CLSID_SHNAPI_Test, 1);
//Add a new notification that utilizes the MRE functionality
sn.cbStruct = sizeof(sn);
sn.dwID = 1;
sn.npPriority = SHNP_INFORM;
sn.csDuration = 15;
sn.hicon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SAMPLEICON));
sn.clsid = CLSID_SHNAPI_Test;
sn.grfFlags = SHNF_STRAIGHTTOTRAY;
sn.pszTodaySK = TEXT("New Task");
sn.pszTodayExec = TEXT("\\windows\\tasks.exe");
//Add the notification to the tray
SHNotificationAdd(&sn);
//Remove the notification from the tray
SHNotificationRemove(&CLSID_SHNAPI_Test, 1);
}

7,655

社区成员

发帖
与我相关
我的任务
社区描述
Windows Phone是微软发布的一款手机操作系统,它将微软旗下的Xbox LIVE游戏、Zune音乐与独特的视频体验整合至手机中。
社区管理员
  • Windows客户端开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧