Here are codes to find out all notifications
void FindAppointment()
{
//HANDLE hNotifications;
DWORD dwAll = 0;
DWORD dwGet = 0;
CeGetUserNotificationHandles (NULL, 0, &dwAll);
HANDLE *hNotifications = new HANDLE [dwAll];
CeGetUserNotificationHandles(hNotifications, dwAll, &dwGet);
for (DWORD i = 0; i < dwAll; i++)
{
DWORD dwBytesNeeded = 0, dwInsufficient = 0;
CE_NOTIFICATION_INFO_HEADER* pHeader;
CeGetUserNotification(hNotifications, 0, &dwBytesNeeded, NULL);
pHeader = (CE_NOTIFICATION_INFO_HEADER *)malloc(dwBytesNeeded);
if (pHeader != NULL)
{
BOOL result;
result = CeGetUserNotification(hNotifications,
dwBytesNeeded, &dwInsufficient, (LPBYTE)pHeader);
if (result == FALSE)
{
;
}
else
{
ShowNotification(pHeader);
}
}
else
;
SAFE_FREE(pHeader);
}
delete[] hNotifications;
}
ShowNotification is a function that I use to show messages about the
notification.
The other question is:
I am trying to add a notification structure like this
TCHAR szExeName[MAX_PATH], szArgs[128] = TEXT("cmdHitByNotification");
CE_NOTIFICATION_TRIGGER cnt;
memset(&cnt, 0, sizeof(cnt));
cnt.dwSize = sizeof(CE_NOTIFICATION_TRIGGER);
cnt.dwType = CNT_TIME ;
cnt.dwEvent = 0;
//cnt.lpszApplication =
TEXT("\\\\.\\Notifications\\NamedEvents\\ABCDEFG");
cnt.lpszApplication = szExeName;
cnt.lpszArguments = szArgs;
cnt.stStartTime = st; // The time that I defined
cnt.stEndTime = et;
GetModuleFileName(g_hInst, szExeName, sizeof(szExeName));
I found that neither the event "ABCDEFG" is not triggered nor the
execution file szExeName is not executed when the notification is
executed...does anyone have any idea about this??
Alan
interuser æ到: