![]() |
Re: RichEdit-Fragen
Zu zweitens...
Delphi-Quellcode:
[edit] das kommt davon, wann man vor dem Abschicken des Beitrags noch schnell was essen geht *g* [/edit]
unit Unit1;
interface uses Windows, Messages, SysUtils, Classes, Controls, Forms, StdCtrls, ComCtrls; type TForm1 = class(TForm) RichEdit1: TRichEdit; procedure FormCreate(Sender: TObject); private { Private declarations } procedure WmNotify(var Message: TWMNotify); message WM_NOTIFY; public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} uses RichEdit, ShellAPI; procedure TForm1.WmNotify(var Message: TWMNotify); type PENLink = ^TENLink; TTextRange = TTextRangeA; var Link: string; Text: TTextRange; begin inherited; with Message do if (Result = Ord(False)) and Assigned(NMHdr) and (NMHdr.code = EN_LINK) then with PENLink(NMHdr)^ do if msg = WM_LBUTTONDOWN then begin SetLength(Link, chrg.cpMax - chrg.cpMin + 1); Link[1] := #0; Text.chrg := chrg; Text.lpstrText := PChar(Link); SendMessage(NMHdr.hwndFrom, EM_GETTEXTRANGE, 0, Integer(Addr(Text))); if StrLen(PChar(Link)) > 0 then begin ShellExecute(Handle, 'open', PChar(Link), nil, nil, SW_SHOWDEFAULT); Result := Ord(True); end; end; end; procedure TForm1.FormCreate(Sender: TObject); begin with RichEdit1 do begin Perform(EM_AUTOURLDETECT, Ord(True), 0); Perform(EM_SETEVENTMASK, 0, Perform(EM_GETEVENTMASK, 0, 0) or ENM_LINK); end; end; end. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:07 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz