Hello,
I'm just trying to work out how to send a parent window of my control a message to notify it that the selection in my window has changed. Reading up on the WM_NOTIFY message, it appears to be designed for telling parents about things (the common controls use it), but given that it seems that the following style of handler has been widely advocated:-
Code:
case WM_NOTIFY:
{
// handle based on notification code
switch (((LPNMHDR)lParam)->code)
{
// ...
}
break;
}
And also that there is no way to ensure that your control's notification codes are unique constants, how can I get round this? Should I advocate a different style in the documentation for the control, like...:-
Code:
case WM_NOTIFY:
{
LPNMHDR lpNmHdr = (LPNMHDR)lParam;
TCHAR szClassName[MAX_PATH];
// handle based on class of notifying window first
GetClassName(lpNmHdr->hwndFrom, szClassName, MAX_PATH);
if (!lstrcmp(szClassName, "SysListView32"))
{
switch (lpNmHdr->code)
{
// ...
}
}
break;
}