Hi all After upgrading to 4.8 we are seeing a "Class already exists"

41 views
Skip to first unread message

Jarek I

unread,
May 16, 2025, 2:50:56 AMMay 16
to Migrated By Firefly
After upgrading to 4.8 we are seeing a "Class already exists" 

I have read the thread https://groups.google.com/g/migrated-by-firefly/c/TJMHUKRikUI/m/2hEOpznzDQAJ.

However, our company performed the migration in 2017, and in our Firefly\UI\RichTextBoxEx.cs file
we do not have the option to set UseVersion41 = false.

Is there any chance to resolve this error in our case?

Best regards
Jarek

Noam Honig

unread,
May 16, 2025, 3:36:40 AMMay 16
to Jarek I, Migrated By Firefly
Hi Jarek,

Here's the relevant code from our updated source code - see if you can apply that to your code somewhere.

Alternatively, you can reach out to Gilad, and ask for an updated version of env & firefly's source code, and you can investigate there and apply the changes selectively to your code.

I don't recommend simply upgrading to the latest firefly & ENV since that would require some testing effort that you may want to avoid

class RichTextBoxV5 : RichTextBox
{
    [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
    static extern IntPtr LoadLibrary(string lpFileName);

    static IntPtr _msfteditHandle = IntPtr.Zero;
    static bool _msfteditNotFound;

    protected override CreateParams CreateParams
    {
        get
        {
            var p = base.CreateParams;
            if (UseVersion41 && !p.ClassName.Equals("RichEdit50W", StringComparison.InvariantCultureIgnoreCase))
            {
                if (_msfteditHandle == IntPtr.Zero && !_msfteditNotFound)
                {
                    _msfteditHandle = LoadLibrary("msftedit.dll");
                    if ((long)_msfteditHandle < 32L)
                        _msfteditNotFound = true;
                }
                if (!_msfteditNotFound)
                    p.ClassName = "RichEdit50W";
            }
            if (BackColor == Color.Transparent)
                p.ExStyle |= 0x20;
            return p;
        }
    }

    public RichTextBoxV5()
    {
        UseVersion41 = true;
        SetStyle(ControlStyles.SupportsTransparentBackColor, true);
        this.DetectUrls = false;
    }

    public override Color BackColor
    {
        get { return base.BackColor; }
        set
        {
            var x = base.BackColor;
            base.BackColor = value;
            if (x != value && (value == Color.Transparent || x == Color.Transparent))
                RecreateHandle();
        }
    }

    internal protected bool UseVersion41 { get; set; }
}




Noam Honig  
Founder & CEO


--
You received this message because you are subscribed to the Google Groups "Migrated By Firefly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to migrated-by-fir...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/migrated-by-firefly/f3e78ba8-5c11-47d2-ac1a-8ff0c51decffn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages