Solved

Send/Receive message

Posted on 1997-11-24
2
662 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone 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

Suggested Solutions

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

713 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