With The Case Of  Release The Power OF  Visual C++ !   HomeProducts | PurchaseSupport | Downloads  
View in English
View in Japanese
View in
View in Franšais
View in Italiano
View in 中文(繁體)
Download Evaluation
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
Features Tour 
Electronic Form Solution
Visualization & HMI Solution
Power system HMI Solution
CAD Drawing and Printing Solution

Bar code labeling Solution
Workflow Solution

Coal industry HMI Solution
Instrumentation Gauge Solution

Report Printing Solution
Graphical modeling Solution
GIS mapping solution

Visio graphics solution
Industrial control SCADA &HMI Solution
BPM business process Solution

Industrial monitoring Solution
Flowchart and diagramming Solution
Organization Diagram Solution

Graphic editor Source Code
UML drawing editor Source Code
Map Diagramming Solution

Architectural Graphic Drawing Solution
Request Evaluation
ActiveX COM Products
Technical Support
  General Q & A
Discussion Board
Contact Us


Get Ready to Unleash the Power of UCanCode .NET

UCanCode Software focuses on general application software development. We provide complete solution for developers. No matter you want to develop a simple database workflow application, or an large flow/diagram based system, our product will provide a complete solution for you. Our product had been used by hundreds of top companies around the world!

"100% source code provided! Free you from not daring to use components because of unable to master the key technology of components!"

CEdit-derived Hyper link control, so user can edit hyper links

By By Paul S. Vickery




The control allows the user to edit the text and the URL independently of each other, or to set them as always the same. A dialog is included to assist the user in editing the URL, similar to those found in some HTML editors.

The control can be set such that it is only a link when it has a URL explicitly set, or if the text looks like a URL. Alternatively, it can set to be always, or never, a link.

Sample Image - HyperEdit_edit_demo.jpg

A context menu item allows the user to invoke the dialog for editing the URL. The control also responds to the Ctrl+K accelerator, which may be changed, in code, to any key combination.

To use the control, just create an edit control, and attach it to a member variable, of type CHyperEdit.


The control is fairly simple, and insight into the workings can easily be gained by looking at the source code.

The public functions are listed below:


  • CHyperEdit();

    Standard empty constructor.

  • void SetLinkOption(HE_OPTION_LINK optLink);

    Sets when to display the text as a link. For details of the options, see the enumeration HE_OPTION_LINK.

  • HE_OPTION_LINK GetLinkOption() const;

    Returns the current link option as set in the above function.

  • void SetUnderlineOption(HE_OPTION_UNDERLINE optUnderline);

    Sets when to display the text underlined. For details of the options, see the enumeration HE_OPTION_UNDERLINE.

  • HE_OPTION_UNDERLINE GetUnderlineOption() const;

    Returns the current underline option as set in the above function.

  • void SetVisited(BOOL bVisited = TRUE);

    Sets whether the link should be displayed as a visited link.

  • BOOL GetVisited() const;

    Returns whether the link has been visited.

  • void SetLinkCursor(HCURSOR hCursor = NULL);

    Sets the cursor to be displayed when moving the mouse over a link. Specifying NULL will cause the control to display its default 'hand' cursor.

  • HCURSOR GetLinkCursor() const;

    Returns the current link cursor.

  • void SetColours(COLORREF crLink, COLORREF crVisited, COLORREF crHover = -1);

    Sets the link colours. crLink specifies the colour for a link, crVisited specifies the colour of a visited link, and crHover specifies the link colour when the users move their mouse over it. If -1 is specified for crHover then the link does not change colour when the users move their mouse.

  • void GetColours(COLORREF* pcrLink, COLORREF* pcrVisited = NULL, 
    	COLORREF* pcrHover = NULL) const;

    This retrieves the current link colours. You may specify NULL for any of the parameters if you do not wish to retrieve its value.

  • void SetIEColours();

    Sets the link colours to the colours chosen in the user's Internet Explorer. If the user does not use Internet Explorer, or the colours have not been set, then they default to blue for the link, purple for a visited link, and no change on hover. Calling GetColours after this function will return the actual values set.

  • void SetDblClkToJump(BOOL bDblClkToJump = TRUE);

    Sets whether to jump to the URL only on double-clicking the link. If bDblClkToJump is FALSE then a single-click will jump to the URL (the default case).

  • BOOL GetDblClkToJump() const;

    Returns whether a double-click is needed to jump to the URL.

  • void SetCtrlClkToJump(BOOL bCtrlClkToJump = TRUE);

    Sets whether to jump to the URL only on control-clicking the link. If bCtrlClkToJump is FALSE then a single-click will jump to the URL (the default case), unless SetDblClkToJump has been set.

  • BOOL GetCtrlClkToJump() const;

    Returns whether a control-click will jump to the URL.

  • void SetURL(LPCTSTR lpszURL = NULL);

    Sets the current URL to the string passed in. If lpszURL is NULL, the URL is cleared.

  • CString GetURL() const;

    Returns the currently set URL.

  • void EditURL();

    Invokes a dialog to allow the user to edit the URL. Help is given with the URLs prefix, similar to the way in which some HTML editors work.

  • void SetURLIsText(BOOL bURLIsText = TRUE);

    If bURLIsText is TRUE, then the URL and the displayed text will always be the same. Editing the URL will change the window text, and vice versa. When first calling this with bURLIsText set to TRUE, when the URL and text are different, they will both be set to whichever next changes.

  • BOOL GetURLIsText() const;

    Returns whether the URL and the text are always the same.

  • void SetEditURLAccelerator(BYTE fVirt = 0, WORD key = 0);

    Allows an accelerator to be set for editing the hyperlink. The default key combination is Ctrl+K. The fVirt and key parameters are as in the members of the ACCEL structure. If fVirt is 0 then no accelerator is set.

  • void GetEditURLAccelerator(BYTE& fVirt, WORD& key);

    Returns the current accelerator used for editing the hyperlink.

  • virtual BOOL IsTextHyperText();

    Determines whether the current edit text is to be treated as a Hyper-link. Returns TRUE if text is a hyper-link, else FALSE. Only called if the link option is set to HEOL_AUTO or HEOL_HASURL. Override this function to use different rules on what makes a valid URL for your application.


typedef enum {
    HEOL_NEVER, // the text will never behave as a link
    HEOL_ALWAYS,// the text will always behave as a link
    HEOL_AUTO,  // the text will behave as a link if it 
                // begins with one of the following:
                // "www", "http:", "file:", "mailto:", "ftp:", 
                // "https:", "gopher:", "nntp:", "prospero:", 
                // "telnet:", "news:", or "wais:".
    HEOL_HASURL // the text will behave as a link if a URL 
                // has been set.

typedef enum {
    HEOU_NEVER, // the text is never underlined
    HEOU_ALWAYS,// the text is always underlined.
    HEOU_HOVER  // the text is underlined when 
                // the user hovers the mouse over it.


Copyright ?1998-2022 UCanCode.Net Software , all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to