Solved

CRichEditView/CRichEditCtrl mesages

Posted on 1998-12-14
2
364 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
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 50 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

747 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

11 Experts available now in Live!

Get 1:1 Help Now