Solved

Send/Receive message

Posted on 1997-11-24
2
618 Views
Last Modified: 2013-11-20
Hi all,
Does anybody know why one application don't receive to message sent from  another application.

In first application I have:

const UINT nMsgID = RegisterWindowMessage( "MESSAGE" );
and
void CSendMessageView::OnButtonSend()
{
  ::SendMessage( HWND_BROADCAST, nMsgID, 0, 0 );
}


and in second:

const UINT  wm_Raport = RegisterWindowMessage( "MESSAGE" );
BEGIN_MESSAGE_MAP(CReceiveMsgView, CView)
  //{{AFX_MSG_MAP(CReceiveMsgView)
  // NOTE - the ClassWizard will add and remove mapping macros here.
  //    DO NOT EDIT what you see in these blocks of generated code!
  //}}AFX_MSG_MAP
  // Standard printing commands
  ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
  ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
  ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
  ON_REGISTERED_MESSAGE(wm_Raport, RaportMsg)
END_MESSAGE_MAP()
and
void CReceiveMsgView::RaportMsg()
{
  MessageBox( "RECEIVE" );
}

But when I click on button for sending message in first application second application is quiet (dont have any raport).

Please help me!

Mileta.
0
Comment
Question by:mileta
2 Comments
 
LVL 7

Accepted Solution

by:
galkin earned 10 total points
ID: 1310681
You must place message handler in your parent frame class, not in view since registered message is sent to main application window and as this is registered message it is not routed standard through MFC message map mechanism and doesn't reach view class.
0
 

Author Comment

by:mileta
ID: 1310682
ThanX
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now