From: SmartDeveloper on
Hi,

I am a C++ developr on a Win Mobile 5.0 platform. I am having problems
with SHNotificationGetData(). Following is the code:
-----------------------------------------------------------------------------
static const GUID CLSID_SHNAPI_OemNotif2 = { 0x99de7411, 0x772f,
0x43d0, { 0x81, 0xf0, 0x66, 0x83, 0x36, 0xca, 0x65, 0x1b } };

SHNOTIFICATIONDATA sn = {0};
SHNOTIFICATIONDATA sn_getNotification = {0};
memset(&sn,0x0,sizeof(sn));

sn.cbStruct = sizeof(sn);
sn.dwID = 1;
sn.npPriority = SHNP_ICONIC;
sn.csDuration = INFINITE;
sn.hicon = LoadIcon(MY_ICON);
sn.clsid = CLSID_SHNAPI_OemNotif2;
sn.grfFlags = SHNF_FORCEMESSAGE;
sn.pszTitle = TEXT("Sample Notification");
SHNotificationAdd(&sn);

/* UNTIL THIS POINT EVERYTHING WORKS FINE*/


memset(&sn_getNotification,0x0,sizeof(sn_getNotification));
UINT ret = SHNotificationGetData(&CLSID_SHNAPI_OemNotif2, 1,
&sn_getNotification);

The function returns successfully. But When I try to look into the
value of "sn_getNotification.clsid", it shows 0-0-0-00-000000. And I
think it should be same as the value of "CLSID_SHNAPI_OemNotif2" give
above.

Can anyone please tell me what exactly is going wrong?

Thanks.

From: Ajay Agrawal on
I think you are NOT setting up the size of SHNOTIFICATIONDATA struct passed
to SHNotoficationGetData.

Try this:
after this line---
memset(&sn_getNotification,0x0,sizeof(sn_getNotification));
sn_getNotification->cbStruct = sizeof(sn_getNotification);

Thanks,
-Ajay


"SmartDeveloper" <mihir.shah(a)gmail.com> wrote in message
news:1140103381.391403.252910(a)g47g2000cwa.googlegroups.com...
> Hi,
>
> I am a C++ developr on a Win Mobile 5.0 platform. I am having problems
> with SHNotificationGetData(). Following is the code:
> -----------------------------------------------------------------------------
> static const GUID CLSID_SHNAPI_OemNotif2 = { 0x99de7411, 0x772f,
> 0x43d0, { 0x81, 0xf0, 0x66, 0x83, 0x36, 0xca, 0x65, 0x1b } };
>
> SHNOTIFICATIONDATA sn = {0};
> SHNOTIFICATIONDATA sn_getNotification = {0};
> memset(&sn,0x0,sizeof(sn));
>
> sn.cbStruct = sizeof(sn);
> sn.dwID = 1;
> sn.npPriority = SHNP_ICONIC;
> sn.csDuration = INFINITE;
> sn.hicon = LoadIcon(MY_ICON);
> sn.clsid = CLSID_SHNAPI_OemNotif2;
> sn.grfFlags = SHNF_FORCEMESSAGE;
> sn.pszTitle = TEXT("Sample Notification");
> SHNotificationAdd(&sn);
>
> /* UNTIL THIS POINT EVERYTHING WORKS FINE*/
>
>
> memset(&sn_getNotification,0x0,sizeof(sn_getNotification));
> UINT ret = SHNotificationGetData(&CLSID_SHNAPI_OemNotif2, 1,
> &sn_getNotification);
>
> The function returns successfully. But When I try to look into the
> value of "sn_getNotification.clsid", it shows 0-0-0-00-000000. And I
> think it should be same as the value of "CLSID_SHNAPI_OemNotif2" give
> above.
>
> Can anyone please tell me what exactly is going wrong?
>
> Thanks.
>


From: SmartDeveloper on
Thanks Ajay.

I have tried that too. But it does not help. The result is still the
same.

Now I am wondering, whether this function is supported on Windows
Mobile 5.0 as it was primarily introduced for Pocket PC.

Let me know.

Ajay Agrawal wrote:
> I think you are NOT setting up the size of SHNOTIFICATIONDATA struct passed
> to SHNotoficationGetData.
>
> Try this:
> after this line---
> memset(&sn_getNotification,0x0,sizeof(sn_getNotification));
> sn_getNotification->cbStruct = sizeof(sn_getNotification);
>
> Thanks,
> -Ajay
>
>
> "SmartDeveloper" <mihir.shah(a)gmail.com> wrote in message
> news:1140103381.391403.252910(a)g47g2000cwa.googlegroups.com...
> > Hi,
> >
> > I am a C++ developr on a Win Mobile 5.0 platform. I am having problems
> > with SHNotificationGetData(). Following is the code:
> > -----------------------------------------------------------------------------
> > static const GUID CLSID_SHNAPI_OemNotif2 = { 0x99de7411, 0x772f,
> > 0x43d0, { 0x81, 0xf0, 0x66, 0x83, 0x36, 0xca, 0x65, 0x1b } };
> >
> > SHNOTIFICATIONDATA sn = {0};
> > SHNOTIFICATIONDATA sn_getNotification = {0};
> > memset(&sn,0x0,sizeof(sn));
> >
> > sn.cbStruct = sizeof(sn);
> > sn.dwID = 1;
> > sn.npPriority = SHNP_ICONIC;
> > sn.csDuration = INFINITE;
> > sn.hicon = LoadIcon(MY_ICON);
> > sn.clsid = CLSID_SHNAPI_OemNotif2;
> > sn.grfFlags = SHNF_FORCEMESSAGE;
> > sn.pszTitle = TEXT("Sample Notification");
> > SHNotificationAdd(&sn);
> >
> > /* UNTIL THIS POINT EVERYTHING WORKS FINE*/
> >
> >
> > memset(&sn_getNotification,0x0,sizeof(sn_getNotification));
> > UINT ret = SHNotificationGetData(&CLSID_SHNAPI_OemNotif2, 1,
> > &sn_getNotification);
> >
> > The function returns successfully. But When I try to look into the
> > value of "sn_getNotification.clsid", it shows 0-0-0-00-000000. And I
> > think it should be same as the value of "CLSID_SHNAPI_OemNotif2" give
> > above.
> >
> > Can anyone please tell me what exactly is going wrong?
> >
> > Thanks.
> >

From: Patrick Derks [MS] on
You may want to try filling out the body of the notification using the
pszHTML structure, MSDN doesn't state that this is an optional field:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mobilesdk5/html/wce51grf_shnotificationdata.asp

There is also an example of what you're trying to do on MSDN:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceshellui5/html/wce50lrfSHNotificationGetData.asp



"SmartDeveloper" <mihir.shah(a)gmail.com> wrote in message
news:1140127309.283260.231960(a)z14g2000cwz.googlegroups.com...
> Thanks Ajay.
>
> I have tried that too. But it does not help. The result is still the
> same.
>
> Now I am wondering, whether this function is supported on Windows
> Mobile 5.0 as it was primarily introduced for Pocket PC.
>
> Let me know.
>
> Ajay Agrawal wrote:
>> I think you are NOT setting up the size of SHNOTIFICATIONDATA struct
>> passed
>> to SHNotoficationGetData.
>>
>> Try this:
>> after this line---
>> memset(&sn_getNotification,0x0,sizeof(sn_getNotification));
>> sn_getNotification->cbStruct = sizeof(sn_getNotification);
>>
>> Thanks,
>> -Ajay
>>
>>
>> "SmartDeveloper" <mihir.shah(a)gmail.com> wrote in message
>> news:1140103381.391403.252910(a)g47g2000cwa.googlegroups.com...
>> > Hi,
>> >
>> > I am a C++ developr on a Win Mobile 5.0 platform. I am having problems
>> > with SHNotificationGetData(). Following is the code:
>> > -----------------------------------------------------------------------------
>> > static const GUID CLSID_SHNAPI_OemNotif2 = { 0x99de7411, 0x772f,
>> > 0x43d0, { 0x81, 0xf0, 0x66, 0x83, 0x36, 0xca, 0x65, 0x1b } };
>> >
>> > SHNOTIFICATIONDATA sn = {0};
>> > SHNOTIFICATIONDATA sn_getNotification = {0};
>> > memset(&sn,0x0,sizeof(sn));
>> >
>> > sn.cbStruct = sizeof(sn);
>> > sn.dwID = 1;
>> > sn.npPriority = SHNP_ICONIC;
>> > sn.csDuration = INFINITE;
>> > sn.hicon = LoadIcon(MY_ICON);
>> > sn.clsid = CLSID_SHNAPI_OemNotif2;
>> > sn.grfFlags = SHNF_FORCEMESSAGE;
>> > sn.pszTitle = TEXT("Sample Notification");
>> > SHNotificationAdd(&sn);
>> >
>> > /* UNTIL THIS POINT EVERYTHING WORKS FINE*/
>> >
>> >
>> > memset(&sn_getNotification,0x0,sizeof(sn_getNotification));
>> > UINT ret = SHNotificationGetData(&CLSID_SHNAPI_OemNotif2, 1,
>> > &sn_getNotification);
>> >
>> > The function returns successfully. But When I try to look into the
>> > value of "sn_getNotification.clsid", it shows 0-0-0-00-000000. And I
>> > think it should be same as the value of "CLSID_SHNAPI_OemNotif2" give
>> > above.
>> >
>> > Can anyone please tell me what exactly is going wrong?
>> >
>> > Thanks.
>> >
>