Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

CRichEditView/CRichEditCtrl mesages

Posted on 1998-12-14
2
Medium Priority
?
406 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

609 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