AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

RichEdit-Fragen

Ein Thema von Lamy · begonnen am 22. Sep 2004 · letzter Beitrag vom 22. Sep 2004
Antwort Antwort
Seite 2 von 2     12   
NicoDE
(Gast)

n/a Beiträge
 
#11

Re: RichEdit-Fragen

  Alt 22. Sep 2004, 20:20
Zu zweitens...

Delphi-Quellcode:
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.
[edit] das kommt davon, wann man vor dem Abschicken des Beitrags noch schnell was essen geht *g* [/edit]
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 2 von 2     12   


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:04 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz