Greetingz to all
I'm trying to code a small text editor as a replacement for
notepad. Till now, all ok but one thing: when pasting text
from other document into my editor, if I use Ctrl+V shortcut
the pasted text keeps the font attributes (size, color, name) from the other editor. If I use the "paste" menu which
sends the EM_PASTESPECIAL, CF_TEXT... message, all is ok.
So why this different behaviour? It seems that richedit control has "built-in support" for copy, paste, cut and undo keyboard shortcuts, but I wonder if I could override
the paste shortcut in a way that it would send an EM_PASTESPECIAL to the control. If someone knows a workaround or even a suggestion, please, help! It is very
annoying :)
Thanks a lot & good luck
(Hey, this is a great msg board!)
Register to receieve ENM_KEYEVENTS notification messsage
Thanks a lot Iczelion! (man, i didn't think at that :) )
Still doesn't work :(
Here's what I did: I wrote "invoke SendMessage,hEdit,EM_SETEVENTMASK,0,ENM_KEYEVENTS"
after RichEdit creation. Then, in the window procedure:
...
.elseif uMsg == WM_NOTIFY
;saved esi and moved lParam to esi
assume esi:ptr NMHDR
.if .code == EN_MSGFILTER
assume esi:ptr MSGFILTER
.if .msg == WM_KEYUP
.if .wParam == 56h
.if CtrlFlag == 1
;really dunno if next 3 lines are OK
mov .msg, EM_PASTESPECIAL
mov .wParam, CF_TEXT
mov .lParam, NULL
.endif
.endif
.endif
.endif
...
CtrlFlag is a global var which is set when ctrl is down and unset when up.
All I got was a dblpaste :) first one bad and the second one ok. So the *integrated* paste still doesn't want to go. Microsoft sais that returning a non zero value after messing with MSGFILTER will force the new msg to be processed, but I tryed and didn't work ,or I'm too damn stupid and I'm missing something :)
Any idea welcomed
Good luck