- Регистрация
- 1 Мар 2015
- Сообщения
- 1,481
- Баллы
- 155
Код:
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdHTTP, Vcl.ExtCtrls, Vcl.AppEvnts, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
IdHTTP1: TIdHTTP;
TrayIcon1: TTrayIcon;
ApplicationEvents1: TApplicationEvents;
Button1: TButton;
procedure Timer1Timer(Sender: TObject);
procedure ApplicationEvents1Minimize(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
notific:string;
implementation
{$R *.dfm}
procedure TForm1.ApplicationEvents1Minimize(Sender: TObject);
begin
ShowWindow(Handle, SW_HIDE);
ShowWindow(Application.Handle, SW_HIDE);
SetWindowLong(Application.Handle, GWL_EXSTYLE,
GetWindowLong(Application.Handle, GWL_EXSTYLE) or (not WS_EX_APPWINDOW));
TrayIcon1.Visible:=True;
TrayIcon1.BalloonTitle:=('Application is hided') ;
TrayIcon1.BalloonHint:=('You text');
TrayIcon1.ShowBalloonHint;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Timer1.Enabled:=false;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if timer1.Enabled=True then
begin
notific:=IdHTTP1.Get('http://lomanu4.at.ua/notific.txt');
Form1.TrayIcon1.BalloonHint:=(notific);
TrayIcon1.ShowBalloonHint;
TrayIcon1.Visible:=True;
end;
end;
end.
Последнее редактирование: