I made this control for my NoteBook
program so that uniform resource locators (URLs) and other links can be appear
and work like they do in plain text e-mails in Microsoft Outlook. They
will appear blue and underlined by default and when clicked on, the relevant
program will open e.g. when an http: link is clicked on, a browser window will
appear with that link navigated to. The control can be downloaded here.
This control only works with the Microsoft Rich Textbox Control.
hyperlink.ocx is very good but seems to have a problem running under
Vista. It gets an error "call to register server dll failed
0x80004005" when you try to register the ocx. Has anyone else come
up against this or know of a solution?
This control uses API functions from shell32.dll and user32.dll.
I can only imagine that this maybe causing a problem.
I have heard that some people have had problems using VB6 with
Windows Vista, but as I don't have it myself, I can't verify this.
Has anyone else had problems with this control in Vista?
Hi ... the control is great. However, when I type some chinese
characters plus a link ... it seems that the hyperlink control cannot
parse the text successfully. Is it true that it does not work with
chinese character? Or does it? Thanks.
Unfortunately I did not program this control to recognise Chinese characters.
Really nice control! I used the "minimum code" as shown in response to another users question and the hyperlinks all work, but they are not displayed in blue or underlined, even though both properties are set to true. Do you have any idea how to correct this? Thanks.
I have just noticed a mistake in the code you were looking at, which
has now been corrected. The URLFormat method must be executed each
time the text in the RichTextBox changes.
If you load a file into the RichTextBox, you will need to run the
URLFormat method afterwards for the underlined blue text to appear.
"Private Sub RichTextBox1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As
gives me the error:
"Procedure declaration does not match description of event or procedure having the same
Also, the Hyperlink is labelled "Hyperlink0", not
"1" but I have corrected this throughout the code you give.
Any idea on the compilation error message?
It could be that you have a different version of the RichTextBox
control to me, which has different arguments. Either try
installing SP6 or if you don't want to do this, try allowing Visual
Basic to generate the code instead of copying mine. Do this by
first selecting 'RichTextBox1' in the Object list box in the Code window
and then by choosing the 'MouseMove' event in the Procedure list box.
Friday, December 24, 2004 at 21:54:27
Very nice control indeed! Can you set it to release the Y coordinate so the hand reverts back to normal and box clicks dont run the hyperlink when the cursor falls below the text in the richtextbox to empty lines? The x 'horizontal movement releases fine. When there is no more text under a hyperlink, someone clicking on blank areas underneath the hyperlink executes the url load event. And selecting text holding down a mouse button, if the button is released under the hyperlink in a blank area launches the url event.
I'm glad you like the control.
At the time of making it, I could not work out how to overcome the
problems you have mentioned. One way around the problem of highlighting
a URL is to put the URLLaunch event into the RichTextBox's MouseDown
event. Therefore if the user starts selecting text and finishes
selecting in a URL, the URL will not be launched.
If you try typing a URL into Microsoft Outlook 2000 (in a plain text
message), you will see that the cursor stays as the hand when the cursor
is under the URL if there is only a URL in the message. So the
Outlook programmers could not find a way around this either.
Wednesday, July 21, 2004 at 13:07:25
In your example you have a textbox showing different URL's. However when I tried this, only the last URL launched whichever URL I clicked on.
How do you set your control to open different URL's?
This is the minimum code you need in your program to get this control
to work properly:
Private Sub RichTextBox1_Change()
Private Sub Hyperlink1_URLChanged()
Caption = Hyperlink1.URL
Private Sub RichTextBox1_Click()
Private Sub RichTextBox1_MouseMove(Button
As Integer, Shift As
Integer, x As Single, y As
Hyperlink1.RichWordOver Me, RichTextBox1, x, y
Please note that you should use the URLFormat method each time the
text in the RichTextBox changes.
Is the source code of the Richtextbox Hyperlink Control available? Thanks in advance.
I do not give away source code for my compiled programs or ActiveX
controls. I learned how to make this control by looking at
projects on the VB
Helper website. I'm sure other websites such as Planet
Source Code will also show you how to do it.
Richtextbox Hyperlink Control is very good, but unfortunally it does not work with spaces... Or does it ?
So is there any way to make hyperlink work with spaces?
This one is not working
file:c:\documents and settings
and this one works fine in many windows applications...
<file:c:\documents and settings>
Unfortunately I could not work out a way of coding this control to
recognise spaces i.e. determine where the ends of the URL is if it
contains spaces. One way around it is to use '%20' instead of a
Martin Allen 1999 - 2012. Last updated
Sunday 30 December 2012 01:56:28 PM -0000.