浏览代码

Method of detecting clicked link was not working on Windows 7 and older.

Source commit: 7c42a0626653c0346c707c15e3a7c671d487db60
Martin Prikryl 9 年之前
父节点
当前提交
ae556f450d
共有 1 个文件被更改,包括 6 次插入13 次删除
  1. 6 13
      source/forms/GenerateUrl.cpp

+ 6 - 13
source/forms/GenerateUrl.cpp

@@ -84,21 +84,14 @@ void __fastcall TRichEdit41::Dispatch(void * AMessage)
       TENLink & ENLink = *reinterpret_cast<TENLink *>(Message.LParam);
       if (ENLink.msg == WM_LBUTTONDOWN)
       {
-        TCharRange CharRange;
-        SendGetStructMessage(Handle, EM_EXGETSEL, 0, &CharRange);
-        SendGetStructMessage(Handle, EM_EXSETSEL, 0, &ENLink.chrg);
-        UnicodeString S = SelText;
-        if (DebugAlwaysTrue(StartsStr(RtfHyperlinkFieldPrefix, S)))
+        UnicodeString Text;
+        for (int Index = 0; Index < Lines->Count; Index++)
         {
-          int P1 = RtfHyperlinkFieldPrefix.Length() + 1;
-          int P2 = PosFrom(L"\"", S, P1);
-          if (DebugAlwaysTrue(P2 > 0))
-          {
-            UnicodeString Url = S.SubString(P1, P2 - P1);
-            ShowHelp(Url);
-          }
+          Text += Lines->Strings[Index] + L"\n";
         }
-        SendGetStructMessage(Handle, EM_EXSETSEL, 0, &CharRange);
+
+        UnicodeString Url = Text.SubString(ENLink.chrg.cpMin + 1, ENLink.chrg.cpMax - ENLink.chrg.cpMin);
+        ShowHelp(Url);
       }
     }
     TRichEdit::Dispatch(AMessage);