Solved

Send/Receive message

Posted on 1997-11-24
2
679 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
[X]
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
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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…
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.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

615 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