Note that there are some explanatory texts on larger screens.

plurals
  1. POHow does a CRichEditCtrl know a paste operation has been performed?
    text
    copied!<p>It has methods like <code>CRichEditCtrl::Copy()</code>, <code>CRichEditCtrl::Paste()</code> which you can call, but I can't spot any messages the control is sent by Windows telling it to <em>perform</em> a paste operation. Does anyone know if such a thing exists? Or does <code>CRichEditCtrl</code> 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?</p> <p>What I actually want is for my custom subclass (<code>CMyRichEditCtrl : CRichEditCtrl</code>) to ignore any formatting on text pasted <em>in</em> 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.</p> <p><strong>What I tried so far:</strong></p> <ol> <li>Checking the message for WM_PASTE in <code>CMyRichEditCtrl::PreTranslateMessage()</code></li> <li>Creating a method <code>virtual void CMyRichEditCtrl::Paste()</code></li> <li>Putting a breakpoint on <code>CRichEditCtrl::Paste()</code> in afxcmn.inl</li> <li><strong>Dumping <em>every</em> message passing through <code>CMyRichEditCtrl::PreTranslateMessage()</code></strong></li> </ol> <p><strong>Results:</strong></p> <p>1: No WM_PASTE message seen<br> 2: It's never called<br> 3: It's never hit... <strong>how?</strong><br> 4: <strong>The control <em>never</em> receives any WM_COMMAND, WM_PASTE or focus-related messages. Basically only mouse-move and key-press messages</strong>.</p> <p>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.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload