i create a richedit control , i need when i paste a text with diffrent font/color/... it will not change the font/color/... exactly like notepad in windows xp (try to copy a text with diffrent fonts/colors it will not be paste with that font/color) how can i do that in masm?
Try this link (http://msdn2.microsoft.com/en-us/library/bb787877(VS.85).aspx). None of this is specific to MASM, so just use the official documentation.
When I first wanted such a functionality, I tried using EM_SETTEXTMODE. I had Windows 98 back then and the message simply didn't work. You could easily paste all the rich text you wanted in the "plain text mode" rich edit. I haven't tried it on Windows XP but I doubt it works. I think its one of those too-good-to-be-true offerings from Microsoft.
The solution that I have used thus far is this:
invoke SendMessage,[hwnd],WM_SETFONT,[hfont],1
invoke SendMessage,[hwnd],EM_SETCHARFORMAT,SCF_ALL,addr cfmt ; cfmt.dwMask=CFM_COLOR
The order of calls is important.
Try to paste some formatted text in the attached RichEd.exe. For me, simple pasting works fine.
[attachment deleted by admin]
Quote from: jj2007 on January 26, 2008, 09:13:12 AM
Try to paste some formatted text in the attached RichEd.exe. For me, simple pasting works fine.
It happily accepts rich text...
when i paste a text with color/font it is pasted with that color/font
i think i didnt explain my problem well,what i need when i paste a text with any color and font it will be pasted with black and system font in the rich edit control
ossama,
here is the code to use with riched 2 and later.
Case 1101
invoke SendMessage,hEdit,WM_UNDO,0,0
Case 1102
invoke SendMessage,hEdit,EM_REDO,0,0
Case 1103
invoke SendMessage,hEdit,WM_CUT,0,0
Case 1104
invoke SendMessage,hEdit,WM_COPY,0,0
Case 1105
invoke SendMessage,hEdit,EM_PASTESPECIAL,CF_TEXT,NULL
Case 1106
invoke SendMessage,hEdit,WM_CLEAR,0,0
This is the code to make the control text only.
invoke SendMessage,hEdit,EM_SETTEXTMODE,TM_PLAINTEXT or \
TM_MULTILEVELUNDO or \
TM_MULTICODEPAGE, 0
thank you hutch--,it works :U
and i dont forgot the others who helped me.
thank you all.