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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 535k
  • Answers 535k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Using Delan's regular expression with preg_replace_callback() makes it very easy… May 17, 2026 at 1:07 am
  • Editorial Team
    Editorial Team added an answer If you declare Cell inside of SparseMatrix, you have to… May 17, 2026 at 1:07 am
  • Editorial Team
    Editorial Team added an answer Simply put this is constraining the generic parameter to a… May 17, 2026 at 1:07 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

So, UIResponder has methods like: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event My question is, what's
I would like to have a JPA Entity that has a GSon Object as
I wanted to develop code in java for a cryptographic algorithms like Blowfish,RC5. I
My view controller has UITextField object as a subview. The controller is set as
I'm trying to embed a browser control in my application (IWebBrowser2). I need to
I have in my model: def presenter @presenter ||= ProfilePresenter.new(self) @presenter end The ProfilePresenter
I am writing helper classes for a large project in PHP and I have
I’m having a little Architecture problem. In my project I have a Business Logic
Scenario You have an Assembly for Data Transfer Objects containing 10 classes that exactly
I'm writing a small visualization tool in wpf, the idea is that average users

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.