|
|
|

| | | | | | | | |  |
 | 
 | Code source : unité LRJ_WinIconNotifArea |  |

|  |
 | |  |

|
Description : cette unité contient l'objet LRJ_TWinIconNotifArea qui facilite
l'iconisation d'une application dans la zone de notification de la barre des
tâches.
L'unité est livrée avec une application de démonstration (
voir description plus loin
) qui utilise les fonctionnalités de
l'objet contenu dans l'unité. Les codes de l'application
sont livrés avec l'unité pour illustrer comment utiliser les méthodes de
cette unité.
L'unité LRJ_WinIconNotifArea met en oeuvre les fonctions de Windows suivantes :
|
|
RegisterWindowMessage
Shell_NotifyIcon
|
Déclarations publiques de l'unité
I
Télécharger l'application de démonstration
I
Exemples d'utilisations
Utilise les unités : Windows, messages, sysutils, classes, controls, shellAPI,
ExtCtrls et
LRJ_WindowsPlus.
Version : 1.0 du 13.07.2009
Auteur : Laurent Hède
Copyright : LorenJo
Nombre de lignes : 333
Réalisée sous : Delphi 6
Systèmes compatibles : NT4, 2000, XP, Vista, serveurs
Prix : 74.00 € H.T.
Déclarations publiques de l'unité :
unit LRJ_WinIconNotifArea;
interface
uses
windows,
messages,
sysutils,
classes,
controls,
shellAPI,
ExtCtrls,
LRJ_WindowsPlus;
type
//-----------OBJET------------------------------------
LRJ_TWinIconNotifArea = class(TObject)
.........
// AParent doit être un objet qui reçoit directement des messages Windows, une TForm par exemple
function CreateNew(const AParent: TWinControl): boolean; virtual;
procedure Delete; virtual;
property Created: boolean read MOIfCreated;
property Hint: string read MOHint write SetHint;
property Icon: HICON read MONotifyIconData.hIcon write SetIcon;
property OnClick: TNotifyEvent read MOOnClick write MOOnClick;
property OnDblClick: TNotifyEvent read MOOnDblClick write MOOnDblClick;
property OnRightClick: TNotifyEvent read MOOnClickRight write MOOnClickRight;
property OnMouseDown: TMouseEvent read MOOnMouseDown write MOOnMouseDown;
property OnMouseUp: TMouseEvent read MOOnMouseUp write MOOnMouseUp;
property OnMouseMove: TMouseMoveEvent read MOOnMouseMove write MOOnMouseMove;
property PosX: Integer read MOPosX;
property PosY: Integer read MOPosY;
property RegisteredMessageName: string read MOMessageName write SetMessageName;
end;//-----------FIN--------------------------
|
Application de démonstration

En cliquant sur le bouton 'Mettre l'application sous forme d'icône', l'application
se met sous forme d'icône dans la zone de notification de la barre des tâches. En
double cliquant sur l'icône de la zone de notification, on remet la fenêtre de
l'application visible ainsi qu'en cliquant sur l'icône et en cliquant sur l'item
'Remettre l'application visible' du PopUpMenu ouvert.
.
Exemples d'utilisations
Codes de l'application de démo.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus,
LRJ_WinIconNotifArea;
type
TForm1 = class(TForm)
Button1: TButton;
PopupMenu1: TPopupMenu;
Fermer1: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Fermer1Click(Sender: TObject);
private
MOIcon: LRJ_TWinIconNotifArea;
procedure OnClickIcon(Sender: TObject);
procedure OnDblClickIcon(Sender: TObject);
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.OnClickIcon(Sender: TObject);
begin
PopupMenu1.Popup(MOIcon.PosX, MOIcon.PosY);
end;
procedure TForm1.OnDblClickIcon(Sender: TObject);
begin
Fermer1Click(self);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
MOIcon := LRJ_TWinIconNotifArea.Create;
MOIcon.RegisteredMessageName := IntToStr(GetCurrentProcess) + application.ExeName;
MOIcon.Hint := 'Démo de WinIconNotifArea';
MOIcon.icon := application.Icon.Handle;
MOIcon.OnClick := OnClickIcon;
MOIcon.OnRightClick := OnClickIcon;
MOIcon.OnDblClick := OnDblClickIcon;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
MOIcon.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if not MOIcon.Created then
if MOIcon.CreateNew(self) then
Hide;
end;
procedure TForm1.Fermer1Click(Sender: TObject);
begin
if MOIcon.Created then
begin
MOIcon.Delete;
Show;
end;
end;
end.
|
Vous n'avez pas trouvé d'exemple répondant à votre problématique ?
Cliquez sur ce lien.
|
|
 |
 | |  |
|
|