SendMessage, GetMessage

I am aware that it is possible to send a message to a window.  Once the message is sent though I do not know how to retrieve it.  I think GetMessage() is the right function but how do I implement this

for example

1.How do I check for messages constantly without blocking users interaction with the window.

2.How do I manualy take care of some messages but leave the rest for windows to take care of.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The message handling is all taken care of by MESSAGE MAP in your class. If you have right kind of message handlers added to map, then MFC will take care of its handling thru your message handlers.

GetParent ()->SendMessage (WM_GRIDDATA_UPDATE, m_Row, (LPARAM)pDataStr);
send a message to its parent.

then i have entry in the message map of parent to handle this message

// In header file

afx_msg LRESULT OnGridDataUpdate (WPARAM wParam, LPARAM lParam); -->>>> HANDLING WM_GRIDDATA_UPDATE message

// In source file

// Message handler function

CGridView::OnGridDataUpdate (WPARAM wParam, LPARAM lParam)
// Do your implementation here.
return TRUE;

2. If you don't want to handle the message , then you can return from that message handler so that message gets routed to next window in queue. When you return TRUE from function, it triggers that message has been taken care of. No further riuting.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.