Re: Custom Control - Notifcation Messages
Thanks for the quick response.
Your absolutely right about the Send/Post.
I just started messing around making my own notification messages.
I'm just curious as to how Notification messages actually work.
I am a bit confused about WM_PARENTNOTIFY and WM_NOTIFY.
I think I am on the right track. I just need verification.
I take it you have read technical notes 61 and 62. I do believe you
should never use WM_PARENTNOTIFY as has well defined system behavior.
Here, I have created my own notification message.
If you are going to write notifications, stick with the paradigm and use
NMHDR as the first structure member:
//notify clicks ............................
typedef struct tagCLVCLICKA
} CLVCLICKA, *LPCLVCLICKA;
This is so all notifications have the same signature. What if you:
BOOL CSomeCtrl::OnWndMsg( UINT message, WPARAM wParam, LPARAM lParam,
LRESULT* pResult )
if( message == WM_NOTIFY )
NMHDR& hdr= *reinterpret_cast<NMHDR*>( lParam );
return CListCtrl::OnWndMsg( message, wParam, lParam, pResult );
Yes, your structure would work but NMHDR sets the discipline.
Then, in OnLButtonDown, OnLButtonUp, OnMouseMove, I send a Notifcation message.
if(GetMouseEvents()) //If MouseEvents Notifcation Messages Enabled
Mouse.hwndFrom = GetSafeHwnd();
Mouse.idFrom = ID_MYCONTROL;
Mouse.code = UWM_MYCONTROL_LBUTTONDOWN;
Mouse.nFlags = nFlags;
Mouse.point = point;
GetParent()->PostMessage(WM_NOTIFY, UWM_MYCONTROL_LBUTTONDOWN, (LPARAM)&Mouse);
Is that basically how it is done?
Yes, but that you should not hardwire the IDs. (I'm not sure how you got
that to work.)
if( ... )
//Check with parent if new row is ok
nr.hdr.hwndFrom= GetSafeHwnd( );
nr.hdr.idFrom= GetDlgCtrlID( );
if( GetParent( )->
SendMessage(WM_NOTIFY, GetParent( )->GetDlgCtrlID( ), (LPARAM)&nr))
InsertRowSet( ... );