Hi.. I'm making some tests to detect URL typing(and email addresses) in
a richedit component in my application.
Looking at Google, and Robert Dunn
website(
http://home.att.net/~robertdunn/Yacs.html), I know that the
TRichEdit componente in BCB uses RichEdit 1.0 and that i must use
version 2.0 or 3.0 to achieve this(and other new options in richedits:
zoom, etc...)
My code for loading the library is (in the form's constructor)
HINSTANCE hInst;
hInst = LoadLibrary("riched20.dll");
if(!hInst)
ShowMessage("not loaded");
Is this fine? (I've never loaded a DLL before, just a newbie)
I found an article in BCB Developer's Journal about detecting
URL'.(showed below).This works fine, but can be and also an email
address detected? Is possible? How could this be done?
Thank you very much.
(Sorry for my poor english)
A.Gil
The code in the example is:
(In the form's constructor)
unsigned mask = SendMessage(RichEdit1->Handle,
EM_GETEVENTMASK, 0, 0);
SendMessage(RichEdit1->Handle, EM_SETEVENTMASK,
0, mask | ENM_LINK);
SendMessage(RichEdit1->Handle, EM_AUTOURLDETECT,
true, 0);
RichEdit1->Text = "The Bridges Publishing Web"
" Site is located at www.bridgespublishing.com. Check"
" it out.";
--------------------------------------------
void __fastcall TForm1::WndProc(
Messages::TMessage &Message)
{
if (Message.Msg == WM_NOTIFY)
{
if (((LPNMHDR)Message.LParam)->code ==EN_LINK)
{
ENLINK* p = (ENLINK *)Message.LParam;
if (p->msg == WM_LBUTTONDOWN)
{
SendMessage(RichEdit1->Handle,
EM_EXSETSEL, 0, (LPARAM)&(p->chrg));
ShellExecute(Handle, "open",
RichEdit1->SelText.c_str(), 0, 0,
SW_SHOWNORMAL);
}
}
}
TForm::WndProc(Message);
}