Linkification re-visited

Started by ianmc, August 25, 2004, 11:33:37 AM

Previous topic - Next topic

ianmc

Hi All,

On the PB forums Michael Mattias kindly said:

'if you send the message EM_AUTOURLDETECT to a richedit control, the control itself will mark links for you...'

How would i do this in Firefly?

Thanks

ian

TechSupport

In the FORM1_WM_CREATE handler you should send the message to your Rich Edit control:

SendMessage HWND_FORM1_RICHEDIT1, %EM_AUTOURLDETECT, %TRUE, 0

This worked for me after I pressed ENTER at the end of the line in the Rich Edit control, the control recognized that the link was present.

ianmc

It creates a link as soon as i type the prefix and start to type the rest
file:C    and its already turned it blue, underlined it and when you hover the pointer over it the pointer turns into a hand.

But,,, nothing happens when i click on it :) i've tried file: and http://www.farstand.com etc. but nothing happens when i click on it.
Is it up to me to write the code to tell it what to do with it? i just want webpages to open in the browser and files to open in their associated applications.

don't ask much do i :) hehe

Thanks for your quick response!

ian

TechSupport

Hi Ian,

Yup, I am pretty sure that you'll have to write the code to respond to it. The message is described on MSDN at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/richedit/richeditcontrols/richeditcontrolreference/richeditmessages/em_autourldetect.asp

It says that when the link is clicked that it sends a WM_NOTIFY notification to the parent Form as an EN_LINK message. You would write the code there to respond to the click.

ianmc

ok,, seems that the richedit control is rather complex :)

messages within messages and i'm not too hot on windows programming yet :) my head was throbbing after i read about it on msdn.

don't suppose you could start me off in the right direction?

I think i'd like to set it to simple text if the linking still works then just be able to get the linked text for my code, then maybe i could check to see if the file is there and if it is SHELL to execute it etc.

I'll figure out how to send a link to a new instance of the user's default browser later :)

Ian