PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

SendMessage, WM_NOTIFY, SHNN_NAVNEXT

I am trying to interact with the notifications and can get the active notifications from the registry (WM5/6 which provides class and id) and want to send the notifications WM_NOTIFY messages with SHNN_DISMISS, SHNN_NAVNEXT etc to control them from my app.

Code:

NMSHN *p = (NMSHN*)GlobalAlloc(GMEM_MOVEABLE, sizeof(NMSHN));
memset(p, 0, sizeof(NMSHN));
p->hdr.code = SHNN_DISMISS;
p->hdr.idFrom = id;
DWORD result = SendMessage(hwnd, WM_NOTIFY, id, (LPARAM)p);
GlobalFree(p);


I suspect GlobalAlloc isn't required but I have tried setting the values in the NMSHN struct to the same as what I get if I raise a notification myself and it doesn't work so was trying that just for something else to do. The idFrom is set to the id of the notification and I use that as the wParam as well because that's how the system sends msgs to my notifications. And the hwnd it's set to is from what is supplied in SHNotificationGetData().

Does anyone know what I'm doing wrong here? I can send messages like this to my own notifications and they can respond properly. Why wouldn't I be able to control other notifications in the same way?

I can use SHNotificationRemove() to forcibly remove a notification but that could leave unfreed mem in the apps that create them if they don't get a valid dismiss msg. Plus I want to be able to cycle through the spinner ones.