Using newer versions of RichEdit?

I tried using RichTextBox in C # and found that it was too slow to work with text in thousands of lines. After some googling, I found this because .net uses RichEdit 2.0 by default, and the solution is to use RichEdit 5.0 instead.

C # RichEditBox has extremely poor performance (4 minutes boot) SOLVED

It worked fine, with text displaying seconds, not minutes. However, as a person who does not care about compatibility in a personal project, I wanted to find later versions of RichEdit. I found out that the latest version is 8.0, all of which are sent as riched20.dll, and partially in msftedit.dll.

http://blogs.msdn.com/b/murrays/archive/2006/10/14/richedit-versions.aspx

http://blogs.msdn.com/b/murrays/archive/2012/03/03/richedit-8-0-preview.aspx

However, the msdn documentation stops with 4.1, with (who, I believe, is) the developer of the project, saying that it no longer makes public documentation on the blog higher.

https://msdn.microsoft.com/en-us/library/windows/desktop/bb787873(v=vs.85).aspx

So far, I could explicitly run msftedit.dll RichEdit 2.0 and 5.0, but all other versions eluded me. For example, despite John Crenshaw commenting that RichEdit 6.0 works fine, I could not use it. Any attempt other than the aforementioned combination of msftedit-2.0 and 5.0 results in the "Window class name invalid" error in Application.Run (). (The program is in C #, but I did not mark it as such, because I was afraid that this problem might not be a C # problem.) The code is an almost exact copy of the solution in the first link and looks like this:

class Textbox : RichTextBox
{
[DllImport("kernel32.dll", EntryPoint = "LoadLibraryW", CharSet = CharSet.Unicode, SetLastError = true)]
private static extern IntPtr LoadLibraryW(string s_File);

public static IntPtr LoadLibrary(string s_File)
{
    IntPtr h_Module = LoadLibraryW(s_File);
    if (h_Module != IntPtr.Zero)
        return h_Module;

    int s32_Error = Marshal.GetLastWin32Error();
    throw new Exception("LoadLibrary Failed with: "+s32_Error);
}

protected override CreateParams CreateParams
{
    get
    {
        CreateParams i_Params = base.CreateParams;
        try
        {
            // Available since XP SP1
            LoadLibrary("MsftEdit.dll"); // throws

            i_Params.ClassName = "RichEdit50W";
        }
        catch
        {
            // Windows XP without any Service Pack.
        }
        return i_Params;
    }
}

What I did was change the ClassName string to different numbers, for example. RichEdit60W.

Windows 8.1, msftedit.dll RichEdit 7.0 8.0 (, , ), . confidencial?

+4
2

RichEdit 8.0 , RICHEDIT60W. C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE15\RICHED20.DLL. , :

using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.ComponentModel;

class RichEdit80 : RichTextBox {
    protected override CreateParams CreateParams {
        get {
            if (moduleHandle == IntPtr.Zero) {
                string path = Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFilesX86);
                path = System.IO.Path.Combine(path, @"Microsoft Shared\OFFICE15\RICHED20.DLL");
                moduleHandle = LoadLibrary(path);
                if ((long)moduleHandle < 0x20) throw new Win32Exception(Marshal.GetLastWin32Error(), "RichEdit control appears to be missing");
            }
            CreateParams createParams = base.CreateParams;
            createParams.ClassName = "RichEdit60W";
            if (this.Multiline) {
                if (((this.ScrollBars & RichTextBoxScrollBars.Horizontal) != RichTextBoxScrollBars.None) && !base.WordWrap) {
                    createParams.Style |= 0x100000;
                    if ((this.ScrollBars & ((RichTextBoxScrollBars)0x10)) != RichTextBoxScrollBars.None) {
                        createParams.Style |= 0x2000;
                    }
                }
                if ((this.ScrollBars & RichTextBoxScrollBars.Vertical) != RichTextBoxScrollBars.None) {
                    createParams.Style |= 0x200000;
                    if ((this.ScrollBars & ((RichTextBoxScrollBars)0x10)) != RichTextBoxScrollBars.None) {
                        createParams.Style |= 0x2000;
                    }
                }
            }
            if ((BorderStyle.FixedSingle == base.BorderStyle) && ((createParams.Style & 0x800000) != 0)) {
                createParams.Style &= -8388609;
                createParams.ExStyle |= 0x200;
            }
            return createParams;
        }
    }

    private static IntPtr moduleHandle;

    [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
    static extern IntPtr LoadLibrary(string lpFileName);
}

. , , , , . DLL - , , Big Red, , Office 2013 . , Office, , , , . fall-back LoadLibrary() .

RichTextBox , . " Word". RichEdit , . , . msftedit.dll

+3

RichEdit, -, Microsoft Office, 1.0, 2.0, 3.0 4.1 Windows .

, RichEdit Microsoft Office: LoadLibrary() " ", Office . Office , : Windows, .

, , . .

+3

All Articles