Click here to Skip to main content
16,008,175 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How can I scroll a CFormView? Pin
Tomasz Sowinski19-Sep-01 6:53
Tomasz Sowinski19-Sep-01 6:53 
GeneralRe: How can I scroll a CFormView? Pin
Craig Miller19-Sep-01 7:04
Craig Miller19-Sep-01 7:04 
GeneralRe: How can I scroll a CFormView? Pin
Tomasz Sowinski19-Sep-01 7:15
Tomasz Sowinski19-Sep-01 7:15 
GeneralRe: How can I scroll a CFormView? Pin
Craig Miller19-Sep-01 9:54
Craig Miller19-Sep-01 9:54 
GeneralPostMessage... philosophy... Pin
Remi Morin19-Sep-01 6:10
Remi Morin19-Sep-01 6:10 
GeneralRe: PostMessage... philosophy... Pin
Tomasz Sowinski19-Sep-01 7:05
Tomasz Sowinski19-Sep-01 7:05 
GeneralRe: PostMessage... philosophy... Pin
Remi Morin19-Sep-01 7:44
Remi Morin19-Sep-01 7:44 
GeneralRe: PostMessage... philosophy... Pin
Tomasz Sowinski19-Sep-01 8:09
Tomasz Sowinski19-Sep-01 8:09 
So your control is designed to be a child of any parent and you want to use ON_CONTROL? It's easy: just remember that you need to call SendMessage rather than PostMessage (there's no need to use a queue). Control notifies its parent by sending one of two messages: WM_COMMAND or WM_NOTIFY.

In 16-bit Windows there was only WM_COMMAND, that's why edit, listbox, button and other 'old' controls use this method. OTOH, common controls that made their debut in 32-bit Windows, like listview, treeview, toolbar etc. use WM_NOTIFY. I'd suggest to use WM_NOTIFY as a method of communitaction between the control and any parent window. Use the following code to notify the parent about some event. Note the NM_SOMEEVENT - this is just a unsigned integer number that your parent needs to know. There's no need to use RegisterMessage in this scenario.
NMHDR hdr = { m_hWnd, ::GetWindowLong(m_hWnd, GWL_ID), NM_SOMEEVENT };
GetParent()->SendMessage(WM_NOTIFY, hdr.idFrom, (LPARAM)&hdr);

Parent will get WM_NOTIFY. MFC magic routes this message through message map. Use ON_NOTIFY to insert the handler into msgmap of parent window:
ON_NOTIFY(NM_SOMEEVENT, IDC_MYHOME_MADE_CONTROL_1, OnSomeEvent)


More details in MSDN, just search for WM_NOTIFY and ON_NOTIFY.

Tomasz Sowinski -- http://www.shooltz.com
GeneralRe: PostMessage... philosophy... Pin
Remi Morin19-Sep-01 9:02
Remi Morin19-Sep-01 9:02 
GeneralRe: PostMessage... philosophy... Pin
Tomasz Sowinski19-Sep-01 9:15
Tomasz Sowinski19-Sep-01 9:15 
GeneralRe: PostMessage... philosophy... Pin
Remi Morin19-Sep-01 9:57
Remi Morin19-Sep-01 9:57 
GeneralRe: PostMessage... philosophy... Pin
Tomasz Sowinski19-Sep-01 10:20
Tomasz Sowinski19-Sep-01 10:20 
GeneralProblem with msadox.dll and msado15.dll Pin
19-Sep-01 5:27
suss19-Sep-01 5:27 
GeneralRe: Problem with msadox.dll and msado15.dll Pin
Remi Morin19-Sep-01 5:53
Remi Morin19-Sep-01 5:53 
GeneralProblem with msadox.dll and msado15.dll Pin
19-Sep-01 5:59
suss19-Sep-01 5:59 
GeneralRe: Problem with msadox.dll and msado15.dll Pin
Carlos Antollini19-Sep-01 5:58
Carlos Antollini19-Sep-01 5:58 
GeneralRe: Problem with msadox.dll and msado15.dll Pin
19-Sep-01 6:04
suss19-Sep-01 6:04 
GeneralLoadString... Pin
19-Sep-01 5:05
suss19-Sep-01 5:05 
GeneralRe: LoadString... Pin
Not Active19-Sep-01 6:04
mentorNot Active19-Sep-01 6:04 
GeneralRe: LoadString... Pin
19-Sep-01 8:06
suss19-Sep-01 8:06 
GeneralRe: LoadString... Pin
Not Active19-Sep-01 9:59
mentorNot Active19-Sep-01 9:59 
GeneralRe: LoadString... Pin
Steen Krogsgaard19-Sep-01 23:39
Steen Krogsgaard19-Sep-01 23:39 
GeneralRe: LoadString... Pin
Carlos Antollini19-Sep-01 10:20
Carlos Antollini19-Sep-01 10:20 
GeneralRe: LoadString... Pin
The_Server19-Sep-01 21:08
The_Server19-Sep-01 21:08 
GeneralRe: LoadString... Pin
The_Server19-Sep-01 21:09
The_Server19-Sep-01 21:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.