?
Solved

CRichEditView/CRichEditCtrl mesages

Posted on 1998-12-14
2
Medium Priority
?
399 Views
Last Modified: 2008-01-16
I have a CRichEditView/CRichEditCtrl application and need to 'grab' some of the 'EM_' messages i.e 'EM_SETPARAFORMAT' and EM_SETCHARFORMAT' before they are sent to the Rich Edit Control so I can modify the message data.

I have tried PreTranslateMessage() but these messages never seem to get there.

How do I intercept these messages.
0
Comment
Question by:bharkness
[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 1

Expert Comment

by:andla
ID: 1180169
I don't know if this will help, but try the message loop before it sends the messages to the window:
while(GetMessage(0,0,0))
{
if(hWnd==hWndMyWindow)
{
//if msg == EM_BlaBla
//Do what you have to do with the message
}
}
0
 
LVL 6

Accepted Solution

by:
snoegler earned 150 total points
ID: 1180170
Another way is to subclass the CRichEditCtrl. Construct a CRichEditCtrl derivate using
ClassWizard, and then use SubclassWindow() to dynamically subclass your existing control.
Now the 'PreTranslateMessage()' handler (of your subclassed window) should catch the
messages. If not (some messages MFC just won't let pass through) you need to use a
construct like this:

WNDPROC oldWndProc=wndRichEditCtrl->GetWindowLong(GWL_WNDPROC);
wndRichEditCtrl->SetWindowLong(GWL_WNDPROC, (LONG)MyWndProc);

.

LRESULT CALLBACK MyWndProc(UINT message, WPARAM wP, LPARAM lP)
{
  ...
  switch(message) {
    ...
    default:
       return (*oldWndProc)(message,wP,lP);
  }
  return 0;
}

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

765 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