SendMessage, GetMessage

Posted on 1999-06-22
Medium Priority
Last Modified: 2013-11-20
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.
Question by:leigh2
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
LVL 23

Accepted Solution

naveenkohli earned 200 total points
ID: 1307654
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.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question