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?

[Webinar] Streamline your web hosting managementRegister Today

naveenkohliConnect With a Mentor Commented:
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.
All Courses

From novice to tech pro — start learning today.