Ce*UserNotification* blues RRS feed

  • Question

  • I've been wasting the last two days trying to get the CeSetUserNotificationEx function to work as I expected it to.

    On my PocketPC application I use SHNotificationAdd to display notifications about pending events and new messages in my application. Now that I am trying to port the application to Smartphone, I can't use SHNotificationAdd anymore as it is only supported on PocketPC.

    The one and only system-provided alternative I could find is CeSetUserNotificationEx. I can get it to display a message (just like the inbuilt calendar reminder), but it doesn't play a sound. It also doesn't change the title, so I'm stuck with "Reminder" as the caption of the notification.

    Code Snippet

    memset (&cun, 0, sizeof(CE_USER_NOTIFICATION));
    cun.ActionFlags = PUN_DIALOG;
    cun.pwszDialogTitle = L"title";
    cun.pwszDialogText = L"message";

    memset (&cnt, 0, sizeof(CE_NOTIFICATION_TRIGGER));
    cnt.dwSize = sizeof(CE_NOTIFICATION_TRIGGER);
    cnt.dwType = CNT_TIME;
    cnt.lpszApplication = 0;

    notificationHandle = CeSetUserNotificationEx(0, &cnt, &cun);

    E.g. says not to combine PUN_SOUND with PUN_DIALOG on Windows Mobile 6 Classic / Professional. Strangely it doesn't mention Windows Mobile 6 Standard. Same for the WM 5.0 page.

    Alright, so I probably have to use CeGetUserNotificationPreferences to have the user select a sound file and whatever else he wants.

    Code Snippet

    memset (&cun, 0, sizeof(CE_USER_NOTIFICATION));

    TCHAR sound[1024];
    cun.pwszSound = sound;
    cun.nMaxSound = 1024;
    cun.ActionFlags = PUN_DIALOG;
    BOOL res = CeGetUserNotificationPreferences(m_hWnd, &cun);

    But this function opens an unusable window on my landscape Windows Mobile 5 smartphone (320x240), i.e. no visible way on how to close the window and it actually looks like it has not been adapted for this resolution at all (see Same on a plain smartphone (i.e. 176x220 resolution) where the right side of the sound combobox is off-screen. Is CeGetUserNotificationPreferences not supported on Smartphone?

    As a reminder, what I want to do is to display a notification window with a custom title and message (think of "new email" or "alarm"), at the same time playing a user-selectable sound, possibly repeating after a short while if the notification is not dismissed. LED/Vibration would be nice as well. From the documentation it sounds like CeSetUserNotificationEx is just the right tool for this - or isn't it?

    Can anybody point out what I may be doing incorrectly? Or has anybody a suggestion on how to accomplish this task using other methods? I know I could just open a message box, but I usually feel it's better to let the system handle notifications.

    Thanks in advance.

    P.S.: The above code does work on Windows Mobile 5.0 for PocketPC (CeGetUserNotificationPreferences can be closed using the OK button and when displaying the notification a sound is played - however, the title of the notification is still fixed to "Reminder" and not my custom title).
    Wednesday, July 4, 2007 3:41 PM

All replies

  • Does nobody have an idea? :-(
    Wednesday, July 11, 2007 4:43 PM
  • This question is still open. Does nobody have any experience with it? Should I report this as a bug to

    Thursday, July 19, 2007 11:40 AM
  • Hmm, how does one report a bug for Windows Mobile?

    Seriously, has nobody ever used CeSetUserNotification on Smartphone - or anybody having a different idea on how to achieve the same functionality?

    Monday, July 23, 2007 11:50 AM
  • Hi Daniel,

        This forum is monitored by Visual Studio for Devices team and this question will be better and more quickly addressed by people on the below newsgroups. Can you please repost this question on these newsgroups?


    Windows Mobile API questions microsoft.public.pocketpc.developer or microsoft.public.smartphone.developer


    I know this is not the best answer, but the question will be more appropriately and faster answered there.


    I am also really sorry for the rather slow response.



    Sadagopan Rajaram

    Development Lead

    Visual Studio for Devices

    Wednesday, July 25, 2007 12:48 PM
  • I posted this question to m.p.smartphone.developer right away - this was two days ago, no response yet ;-) Will continue waiting and hoping that someone knows something about it :-)
    Friday, July 27, 2007 1:06 PM