Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CRichEditCtrl Problem of displaying text as hyperlink

CRichEditCtrl Problem of displaying text as hyperlink

Scheduled Pinned Locked Moved C / C++ / MFC
help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dhiraj kumar Saini
    wrote on last edited by
    #1

    I am using CChatRichEd class derived from CRichEditCtrl downloaded from codeproject to show url as hyperlink in my RichEdit control. Now when I click the url to open the respective url I am facing 3 problems. 1. I neew to click it twice although it should open on a single click. 2. Secondly On clicking the URL link and after the url gets openend if i look at the RichEdit control the cursor is at the position in the url where mouse was clicked and it blinks over as there as a result of which the next text appears at that position where the mouse was clicked. I want that the the cursor should not be displayed and blink and should move to the next line after the link. I am using the following code for opening the URL:

    BOOL CChatRichEd::OnLink(NMHDR *pNotifyHeader, LRESULT *pResult)
    {
    ENLINK *pENLink = (ENLINK *) pNotifyHeader;
    CString URL ;
    CHARRANGE CharRange ;

    \*pResult = 0;
    
    switch (pNotifyHeader->code)
    {
    case EN\_LINK:
    	pENLink = (ENLINK \*) pNotifyHeader;
    
    	switch (pENLink->msg)
    	{
    	case WM\_LBUTTONDOWN:
    		GetSel(CharRange);
    		SetSel(pENLink->chrg);
    		URL = GetSelText();
    		SetSel(CharRange);
    
    		{
    			CWaitCursor WaitCursor;
    
    			ShellExecute(GetSafeHwnd(), \_T("open"), URL, NULL, NULL, SW\_SHOWNORMAL);
    			\*pResult = 1;
    		}
    		
    		break;
    
    	case WM\_LBUTTONUP:
    		\*pResult = 1;
    		break ;
    	}
    	
    	break;
    }
    return 0;
    

    }

    Please help me. Thanks Dhiraj

    D 1 Reply Last reply
    0
    • D Dhiraj kumar Saini

      I am using CChatRichEd class derived from CRichEditCtrl downloaded from codeproject to show url as hyperlink in my RichEdit control. Now when I click the url to open the respective url I am facing 3 problems. 1. I neew to click it twice although it should open on a single click. 2. Secondly On clicking the URL link and after the url gets openend if i look at the RichEdit control the cursor is at the position in the url where mouse was clicked and it blinks over as there as a result of which the next text appears at that position where the mouse was clicked. I want that the the cursor should not be displayed and blink and should move to the next line after the link. I am using the following code for opening the URL:

      BOOL CChatRichEd::OnLink(NMHDR *pNotifyHeader, LRESULT *pResult)
      {
      ENLINK *pENLink = (ENLINK *) pNotifyHeader;
      CString URL ;
      CHARRANGE CharRange ;

      \*pResult = 0;
      
      switch (pNotifyHeader->code)
      {
      case EN\_LINK:
      	pENLink = (ENLINK \*) pNotifyHeader;
      
      	switch (pENLink->msg)
      	{
      	case WM\_LBUTTONDOWN:
      		GetSel(CharRange);
      		SetSel(pENLink->chrg);
      		URL = GetSelText();
      		SetSel(CharRange);
      
      		{
      			CWaitCursor WaitCursor;
      
      			ShellExecute(GetSafeHwnd(), \_T("open"), URL, NULL, NULL, SW\_SHOWNORMAL);
      			\*pResult = 1;
      		}
      		
      		break;
      
      	case WM\_LBUTTONUP:
      		\*pResult = 1;
      		break ;
      	}
      	
      	break;
      }
      return 0;
      

      }

      Please help me. Thanks Dhiraj

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Dhiraj kumar Saini wrote:

      1. I neew to click it twice although it should open on a single click.

      Based on what?

      "Love people and use things, not love things and use people." - Unknown

      "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups