From: Eric Mullins Date: Sat, 10 Oct 2009 08:03:45 +0000 (-0600) Subject: added URL detection and provided hotlinks in the ICS client X-Git-Tag: v4.4.1.20091019~45 X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=9077cfe5ee13a5197fe0990b0096fa452898054f added URL detection and provided hotlinks in the ICS client --- diff --git a/winboard/winboard.c b/winboard/winboard.c index 0fa4807..99f95ba 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -8245,6 +8245,23 @@ ConsoleWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) MINMAXINFO *mmi; switch (message) { + case WM_NOTIFY: + if (((NMHDR*)lParam)->code == EN_LINK) + { + ENLINK *pLink = (ENLINK*)lParam; + if (pLink->msg == WM_LBUTTONUP) + { + TEXTRANGE tr; + + tr.chrg = pLink->chrg; + tr.lpstrText = malloc(1+tr.chrg.cpMax-tr.chrg.cpMin); + hText = GetDlgItem(hDlg, OPT_ConsoleText); + SendMessage(hText, EM_GETTEXTRANGE, 0, (LPARAM)&tr); + ShellExecute(NULL, "open", tr.lpstrText, NULL, NULL, SW_SHOW); + free(tr.lpstrText); + } + } + break; case WM_INITDIALOG: /* message: initialize dialog box */ hwndConsole = hDlg; hText = GetDlgItem(hDlg, OPT_ConsoleText); @@ -8365,10 +8382,18 @@ ConsoleWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) VOID ConsoleCreate() { - HWND hCons; + HWND hCons, hText; + WORD wMask; if (hwndConsole) return; hCons = CreateDialog(hInst, szConsoleName, 0, NULL); SendMessage(hCons, WM_INITDIALOG, 0, 0); + + + // make the text item in the console do URL links + hText = GetDlgItem(hCons, OPT_ConsoleText); + wMask = SendMessage(hText, EM_GETEVENTMASK, 0, 0L); + SendMessage(hText, EM_SETEVENTMASK, 0, wMask | ENM_LINK); + SendMessage(hText, EM_AUTOURLDETECT, TRUE, 0L); }