Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 614437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:06:42+00:00 2026-05-13T18:06:42+00:00

It has methods like CRichEditCtrl::Copy() , CRichEditCtrl::Paste() which you can call, but I can’t

  • 0

It has methods like CRichEditCtrl::Copy(), CRichEditCtrl::Paste() which you can call, but I can’t spot any messages the control is sent by Windows telling it to perform a paste operation. Does anyone know if such a thing exists? Or does CRichEditCtrl do something lower-level like monitoring WM_CHAR events? If so can I reuse any internal methods or would I just have to roll my own in order to override the standard paste functionality?

What I actually want is for my custom subclass (CMyRichEditCtrl : CRichEditCtrl) to ignore any formatting on text pasted in to the control. Either by getting the clipboard data in a different clipboard format, or by pasting it in as normal and immediately removing formatting on inserted text.

What I tried so far:

  1. Checking the message for WM_PASTE in CMyRichEditCtrl::PreTranslateMessage()
  2. Creating a method virtual void CMyRichEditCtrl::Paste()
  3. Putting a breakpoint on CRichEditCtrl::Paste() in afxcmn.inl
  4. Dumping every message passing through CMyRichEditCtrl::PreTranslateMessage()

Results:

1: No WM_PASTE message seen
2: It’s never called
3: It’s never hit… how?
4: The control never receives any WM_COMMAND, WM_PASTE or focus-related messages. Basically only mouse-move and key-press messages.

It seems other people have actually done this successfully. I’m wondering if my MFC version or something could be screwing it up, at this point.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:06:43+00:00Added an answer on May 13, 2026 at 6:06 pm

    Handle EN_PROTECTED message.

    ON_NOTIFY_REFLECT(EN_PROTECTED, &YourClass::OnProtected)
    
    // call this from the parent class
    void YourClass::Initialize()
    {
        CHARFORMAT format = { sizeof(CHARFORMAT) };
        format.dwEffects = CFE_PROTECTED; 
        format.dwMask = CFM_PROTECTED;
    
        SetDefaultCharFormat(format);
        SetEventMask(ENM_PROTECTED);
    }
    
    void YourClass::OnProtected(NMHDR* pNMHDR, LRESULT* pResult)
    {
        *pResult = 0; 
    
        ENPROTECTED* pEP = (ENPROTECTED*)pNMHDR;
        if (pEP->msg == WM_PASTE)
            pResult = 1; // prevent paste
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JQuery control which has some private methods. I would like to
Linq in general, has extensions methods(at IEnumerable) like Where, Select, OrderBy. But use another
I have a class that extends Application which has a lot of methods like:
I have a class Foo which has several methods like button_0_0 , button_0_1 ,
I have a class which has some methods like follows (And more): template<class T>
ReadOnlyCollection<T> realises the ICollection<T> interface which has methods like Add and Remove. I know
So, UIResponder has methods like: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event My question is, what's
I'm implementing a CORBA like server. Each class has remotely callable methods and a
My ASP.NET app has some server-side methods whose results I'd like to inject into
Qt's QImage has two methods: uchar* QImage::bits(); const uchar* QImage::bits() const; But how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.