📦 deluan / BBtray

📄 Mesg.pas · 62 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// BBtray: Message Unit
//
// (c) 1999,2001 - Deluan Cotts Quintão
// bbtray@deluan.com.br
//

unit Mesg;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ShellApi;

type
  TfrmMesg = class(TForm)
    Label1: TLabel;
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure Label1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure ShowMesg(msg: String; color: TColor);
  end;

var
  frmMesg: TfrmMesg;

implementation

uses Main;

{$R *.DFM}

procedure TfrmMesg.ShowMesg(msg: String; color: TColor);
begin
     Label1.Caption := Msg;
     Label1.Color := Color;
     Show;
end;

procedure TfrmMesg.FormKeyPress(Sender: TObject; var Key: Char);
begin
     if Key = #27 then
        Close
     else if Key = #13 then
        Label1Click(Sender);
end;

procedure TfrmMesg.Label1Click(Sender: TObject);
begin
  ShellExecute(Application.MainForm.Handle, Nil, PChar(MainForm.FDisplayURL),
               Nil, Nil, SW_SHOW);
  Close;
end;

end.