News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Richedit wrap

Started by HSE, November 01, 2022, 04:19:33 AM

Previous topic - Next topic

NoCforMe

Quote from: HSE on November 01, 2022, 11:03:59 PM
Perfect. I have to see if that value can be detected with EM_POSFROMCHAR  :biggrin:

That message has some crazy parameters:
Quote
wParam
   Rich Edit 1.0 and 3.0: A pointer to a POINTL structure that receives the client area coordinates of the character.
   The coordinates are in screen units and are relative to the upper-left corner of the control's client area.

   Edit controls and Rich Edit 2.0: The zero-based index of the character.

lParam
   Rich Edit 1.0 and 3.0: The zero-based index of the character.

   Edit controls and Rich Edit 2.0: This parameter is not used.

So I take it you're going to check which version of RichEdit you're talking to, right? What a pain in the butt.
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: NoCforMe on November 02, 2022, 12:16:33 PMSo I take it you're going to check which version of RichEdit you're talking to, right? What a pain in the butt.

Indeed, it's very messy. Currently, I'm in the process of changing my editor from Ansi/Utf-8 to the Utf-16 version of the RichEdit control. The version I am using now is RichEdit60W.

Almost 8 years ago dpradov posted Allow the use of newer versions of RichEdit:
QuoteOFFICE 2007  (12) :  v6.0
C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE12\RICHED20.DLL
RichEdit Version 6.0
Product/file version: 12.0.6606.1000
Product name: 2007 Microsoft Office system
(+ msptls.dll)
ClassName: 'RichEdit60W'

I don't have Office 2007 installed, and I load from C:\Windows\System32\msftedit.dll

So I am a bit confused why it works on my ten year old Win7-64 machine.

Can I ask you a favour? Extract the attached files to a folder, then drag the rtf over the exe and hit F9. Tell me what you see as version info in the last line. Thanks :thup:

NoCforMe

#17
No Word 2007 here; I went back to Word 2000 (actually prefer it over the newer versions).

Computer is totally screwed up here; time for a completely new rig, unfortunately.

Edit = Profanity
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: NoCforMe on November 02, 2022, 10:50:06 PM
No Word 2007 here; I went back to Word 2000 (actually prefer it over the newer versions).

I agree - Word 2003 here.

Thanks for the screenshot, so it works with older versions of C:\Windows\System32\msftedit.dll
My Win7 version is 21 ‎November ‎2010, ‏‎04:24:01, 592,348 bytes.

You can load several "W" versions with msftedit.dll
50W has the space before problem, 20W and 60W don't (WordPad uses 50W)
50W is almost a factor 2 faster, but I hate the way it handles space before the paragraphs.

So in the end I voted for the most advanced msftedit version, which is 60W :cool:

Google phrase searches for "RichEdit70W" and "RichEdit80W" return few results. They exist but nobody uses them.

The topic pops up frequently here, see e.g. RICHEDIT diferences between RICHEDIT50W and RichEdit20A

HSE

Hi all!

Take some hours  :biggrin:

modify1 parse RichEdit content extracted (EM_STREAMOUT) to a buffer p1, and write to a buffer p2 that is sended (WM_SETTEXT) to same RichEdit, also need the original rtf size (the stream out, no text size) in RichEdit :

    writechars macro Expression
        FORC char,<&Expression>
            mov byte ptr [xdi],"&char"
            add xdi, 1
        ENDM
    endm   
                           
    modify1 proc uses xsi xdi xbx p1:POINTER,p2:POINTER, tSize:POINTER
        local final : POINTER
        local cuenta : dword
        local ini1 : dword, i : dword
        local buffer[12]:CHRA
        local bufsize:dword
       
        mov cuenta , 0
        mov xsi, p1
        mov xax, tSize
        add xax, xsi
        mov final, xax
        mov xdi, p2
        .while xsi <= final
            mov al, [xsi]
            .if al == 0Ah
                mov byte ptr [xdi], al
                inc xdi
                ;inc cuenta
                .repeat
                    inc xsi
                    mov al, [xsi]
                    .if al == " "
                        inc xsi
                        inc cuenta
                    .else
                        .if cuenta > 0
                            push eax
                            writechars \pard\fi-
                            add cuenta, 2
                            mov eax, cuenta
                            mov ecx, 160
                            mul ecx
                            invoke udword2decA, addr buffer, eax
                            invoke StrLengthA, addr buffer
                            dec eax
                            mov bufsize, eax
                            lea xbx, buffer
                            ForLp i, 0, eax, ecx
                                mov dl, [xbx+xcx]
                                mov byte ptr [xdi], dl
                                inc xdi
                            Next i
                            writechars \li
                            lea xbx, buffer
                            ForLp i, 0, bufsize, ecx
                                mov dl, [xbx+xcx]
                                mov byte ptr [xdi], dl
                                inc xdi
                            Next i
                            writechars \tx0\tab
                            if 0
                            ForLp i, 0, cuenta, ecx
                                mov byte ptr [xdi]," "
                                inc xdi
                            Next i
                            endif
                            pop eax
                            mov byte ptr [xdi], al
                            inc xdi
                        .else   
                            mov byte ptr [xdi], al
                            inc xdi
                        .endif
                        mov cuenta, 0
                        jmp vuelve1       
                    .endif
                .until xsi > final
            vuelve1:
            .else
                mov byte ptr [xdi], al
                inc xdi         
            .endif
            inc xsi
        .endw
        mov byte ptr [xdi], 0
        inc xdi         
        ret
    modify1 endp


Sorry, this became "not so Campus subject" :biggrin:

Thanks, HSE.
Equations in Assembly: SmplMath

jj2007

Quote from: jj2007 on November 02, 2022, 07:41:18 PMCurrently, I'm in the process of changing my editor from Ansi/Utf-8 to the Utf-16 version of the RichEdit control. The version I am using now is RichEdit60W.

New version released, download here (more).