We help IT Professionals succeed at work.
Get Started

RichTextBox LinkClicked not returning hidden text

Last Modified: 2013-11-07
I have an odd problem.  I am using a customised RichTextBox control (System.Windows.Forms.RichTextBox) that displays custom links (by inserting the text then applying CFE_LINK effect to the inserted text).  However, I need some extra information that I do not want displayed in the richtextbox.  This information I write as text to the link, and apply CFE_HIDDEN effect to it.

The problem is that I am not receiving the extra text when the dll is called from the actual target app (though am in my test app).

The RTB is in a custom control in a dll.  For testing, I call this from a basic .Net app.  In testing, the LinkClicked event returns the expected text - both hidden and unhidden.  This is what I need.

When I use the same form from my VB6 dll (actually an Outlook plugin), LinkClicked fails to return the hidden text.  I have tried many things with no success - and I do not understand why the behaviour should be different when the window is called from VB6.  If I unhide the text, everything works properly - but this is not something I can do; the text absolutely has to be hidden.

Any ideas?

If I could subclass the .Net RTB and trap the EN_LINK notification, then I'm sure that I could resolve the issue.  However, I do not know if this is possible without a lot of effort - as to subclass (as far as I am aware), I would need to inherit my custom RTB from System.Windows.Forms.NativeWindow, which would mean I'd have to rewrite pretty much the entire RTB code.  Not something I want to do!
Watch Question
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009
This problem has been solved!
Unlock 1 Answer and 13 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE