News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

rich edit and 'paste' operation

Started by ossama, January 25, 2008, 05:41:18 PM

Previous topic - Next topic

ossama

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?

jj2007

Try this link. None of this is specific to MASM, so just use the official documentation.

xmetal

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.

jj2007

Try to paste some formatted text in the attached RichEd.exe. For me, simple pasting works fine.

[attachment deleted by admin]

xmetal

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...

ossama

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

hutch--

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
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

ossama


ossama

and i dont forgot the others who helped me.
thank you all.