views:

45

answers:

1

I added a context menu to a MFC CRichEditCtrl, it includes a delete option which does: ReplaceSel("",TRUE);

It appears to work but when I look at the undo log, it's not the same... we end up with characters being lost at the end of the sequence.

Any ideas how I can make my code be the same as what happens when you press DELETE? Or even reuse that default functionality?

A: 

SetFocus to edit window, and then keybd_event of delete key?

Or see if a WM_COMMAND message is triggered when the del key is hit and send the same message. You could have a look at their resources (using ResHacker or the like) and see if the DEL key is an accelerator for an existing WM_COMMAND message, or just use SpyXX.

Mark