| 1 | unit Details;
|
|---|
| 2 |
|
|---|
| 3 | interface
|
|---|
| 4 |
|
|---|
| 5 | uses
|
|---|
| 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|---|
| 7 | Dialogs, StdCtrls, ExtCtrls, ComCtrls, ShellApi, RichEdit;
|
|---|
| 8 |
|
|---|
| 9 | type
|
|---|
| 10 | TForm7 = class(TForm)
|
|---|
| 11 | Label1: TLabel;
|
|---|
| 12 | Label2: TLabel;
|
|---|
| 13 | Image1: TImage;
|
|---|
| 14 | Timer1: TTimer;
|
|---|
| 15 | Label3: TLabel;
|
|---|
| 16 | Label4: TLabel;
|
|---|
| 17 | Label5: TLabel;
|
|---|
| 18 | RichEdit1: TRichEdit;
|
|---|
| 19 | procedure FormShow(Sender: TObject);
|
|---|
| 20 | procedure Timer1Timer(Sender: TObject);
|
|---|
| 21 | procedure FormCreate(Sender: TObject);
|
|---|
| 22 | private
|
|---|
| 23 | { Private declarations }
|
|---|
| 24 | public
|
|---|
| 25 | { Public declarations }
|
|---|
| 26 | protected
|
|---|
| 27 | procedure WndProc(var Msg: TMessage); override;
|
|---|
| 28 | end;
|
|---|
| 29 |
|
|---|
| 30 | var
|
|---|
| 31 | Form7: TForm7;
|
|---|
| 32 |
|
|---|
| 33 | DetailsServerIndex: integer;
|
|---|
| 34 |
|
|---|
| 35 | implementation
|
|---|
| 36 |
|
|---|
| 37 | uses Main;
|
|---|
| 38 |
|
|---|
| 39 | {$R *.dfm}
|
|---|
| 40 |
|
|---|
| 41 | procedure TForm7.FormShow(Sender: TObject);
|
|---|
| 42 | var
|
|---|
| 43 | BitMap: TBitmap;
|
|---|
| 44 | begin
|
|---|
| 45 | Label1.Caption := Form1.Servers[DetailsServerIndex].Name;
|
|---|
| 46 | Label2.Caption := 'Addresa: '+Form1.Servers[DetailsServerIndex].Address;
|
|---|
| 47 | if Form1.Servers[DetailsServerIndex].Image <> '' then begin
|
|---|
| 48 | if Form1.Servers[DetailsServerIndex].Image = '1' then begin
|
|---|
| 49 | BitMap := TBitmap.Create;
|
|---|
| 50 | Form1.ImageList32default.GetBitmap(1,BitMap);
|
|---|
| 51 | Image1.Picture.Graphic := BitMap;
|
|---|
| 52 | end else begin
|
|---|
| 53 | if FileExists(Form1.Servers[DetailsServerIndex].Image) then begin
|
|---|
| 54 | Image1.Picture.LoadFromFile(Form1.Servers[DetailsServerIndex].Image);
|
|---|
| 55 | end;
|
|---|
| 56 | end;
|
|---|
| 57 | end else begin
|
|---|
| 58 | BitMap := TBitmap.Create;
|
|---|
| 59 | Form1.ImageList32default.GetBitmap(0,BitMap);
|
|---|
| 60 | Image1.Picture.Graphic := BitMap;
|
|---|
| 61 | end;
|
|---|
| 62 | RichEdit1.Text := Form1.Servers[DetailsServerIndex].Description;
|
|---|
| 63 | Timer1.Enabled := true;
|
|---|
| 64 | end;
|
|---|
| 65 |
|
|---|
| 66 | procedure TForm7.Timer1Timer(Sender: TObject);
|
|---|
| 67 | begin
|
|---|
| 68 | close;
|
|---|
| 69 | Timer1.Enabled := false;
|
|---|
| 70 | end;
|
|---|
| 71 |
|
|---|
| 72 | procedure TForm7.FormCreate(Sender: TObject);
|
|---|
| 73 | begin
|
|---|
| 74 | Form1.InitRichEditURLDetection(RichEdit1);
|
|---|
| 75 | end;
|
|---|
| 76 |
|
|---|
| 77 | procedure TForm7.WndProc(var Msg: TMessage);
|
|---|
| 78 | var
|
|---|
| 79 | p: TENLink;
|
|---|
| 80 | sURL: string;
|
|---|
| 81 | CE : TRichEdit;
|
|---|
| 82 | begin
|
|---|
| 83 | if (Msg.Msg = WM_NOTIFY) then
|
|---|
| 84 | begin
|
|---|
| 85 | if (PNMHDR(Msg.lParam).code = EN_LINK) then
|
|---|
| 86 | begin
|
|---|
| 87 | p := TENLink(Pointer(TWMNotify(Msg).NMHdr)^);
|
|---|
| 88 | if (p.Msg = WM_LBUTTONDOWN) then
|
|---|
| 89 | begin
|
|---|
| 90 | try
|
|---|
| 91 | CE := TRichEdit(Form7.ActiveControl);
|
|---|
| 92 | SendMessage(CE.Handle, EM_EXSETSEL, 0, Longint(@(p.chrg)));
|
|---|
| 93 | sURL := CE.SelText;
|
|---|
| 94 | ShellExecute(Handle, 'open', PChar(sURL), nil, nil, SW_SHOWNORMAL);
|
|---|
| 95 | except
|
|---|
| 96 | end;
|
|---|
| 97 | end;
|
|---|
| 98 | end;
|
|---|
| 99 | end;
|
|---|
| 100 |
|
|---|
| 101 | inherited;
|
|---|
| 102 |
|
|---|
| 103 | end;
|
|---|
| 104 |
|
|---|
| 105 | end.
|
|---|