Hallo,
Kann mir jemand sagen wie ich mein Programm unten rechts in die Taskleiste als Symbol bekomme.
Evtl. ein kleines Demo währe super.
Benutze Delphi 5
Besten Dank
Hallo,
Kann mir jemand sagen wie ich mein Programm unten rechts in die Taskleiste als Symbol bekomme.
Evtl. ein kleines Demo währe super.
Benutze Delphi 5
Besten Dank
Hi Michael
Application.Minimize
Servus,
Manfred
Hallo Manfred,
ich meinte die Taskbar unten rechts in der Ecke wo auch das Uhrzeitsymbol und das Lautsprechersymbol erscheint.
Gruss Michael
[Bei dieser Antwort wurde das Vollzitat nachträglich automatisiert entfernt]
Gefunden bei Google, soolte alles abdecken. Es gibt aber auch diverse Komponenten, die das Handling erheblich vereinfachen. Such mal nach Trayicon.
Gruss und viel Erfolg
RQ
Joe C. Hecht wrote:
http://home1.gte.net/joehecht/index.htm
Here is an example that once existed on the Borland site. It costs
nothing.
and is a valuable resource if you are interested in learing how it is
done.
Joe
This is done via the ShellAPI function Shell_NotifyIcon(); The following
example
shows how to create an application that uses this function. The example
application
shows a different icon in the system tray every second and shows the
time in the title.
The application responds to a right click of the mouse by showing a menu
allowing
the user to display a form or quit the application. Attempts to close
the form result in
the form hiding, but the tray application continues to run. Note that no
task bar icon is
shown for the form. To compile the application, you will need to create
form with a
TPopupMenu and a TTimer component. You will also need to make
modifications
to the main project source file (TrayIt.dpr).
Example:
{TrayIt.dpr}
program TrayIt;
uses
Windows,
Forms,
TrayIt1 in ‚TrayIt1.pas‘ {Form1};
{$R *.RES}
begin
Application.Initialize;
Application.ShowMainForm := False;
Application.CreateForm(TForm1, Form1);
ShowWindow(Application.Handle, SW_HIDE);
Application.Run;
end.
{TrayIt1.pas}
unit TrayIt1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,
Menus, ShellAPI, ExtCtrls;
type
TForm1 = class(TForm)
PopupMenu1: TPopupMenu;
Open1: TMenuItem;
Exit1: TMenuItem;
Timer1: TTimer;
procedure FormCreate(Sender: TObject);
procedure Open1Click(Sender: TObject);
procedure Exit1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
procedure WndProc(var Msg : TMessage); override;
public
{ Public declarations }
IconData : TNotifyIconData;
IconCount : integer;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WndProc(var Msg : TMessage);
var
p : TPoint;
begin
case Msg.Msg of
WM_USER + 1:
case Msg.lParam of
WM_RBUTTONDOWN: begin
SetForegroundWindow(Handle);
GetCursorPos§;
PopupMenu1.Popup(p.x, p.y);
PostMessage(Handle, WM_NULL, 0, 0);
end
end;
end;
inherited;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
BorderIcons := [biSystemMenu];
IconCount := 0;
IconData.cbSize := sizeof(IconData);
IconData.Wnd := Handle;
IconData.uID := 100;
IconData.uFlags := NIF_MESSAGE + NIF_ICON + NIF_TIP;
IconData.uCallbackMessage := WM_USER + 1;
IconData.hIcon := Application.Icon.Handle;
StrPCopy(IconData.szTip, Application.Title);
Shell_NotifyIcon(NIM_ADD, @IconData);
Timer1.Interval := 1000;
Timer1.Enabled := true;
end;
procedure TForm1.Open1Click(Sender: TObject);
begin
Form1.Show;
ShowWindow(Application.Handle, SW_HIDE);
end;
procedure TForm1.Exit1Click(Sender: TObject);
begin
Shell_NotifyIcon(NIM_DELETE, @IconData);
Application.ProcessMessages;
Application.Terminate;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caNone;
Form1.Hide;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
case(IconCount) of
0 : IconData.hIcon := LoadIcon(0, IDI_APPLICATION);
1 : IconData.hIcon := LoadIcon(0, IDI_ASTERISK);
2 : IconData.hIcon := LoadIcon(0, IDI_EXCLAMATION);
3 : IconData.hIcon := LoadIcon(0, IDI_HAND);
4 : IconData.hIcon := LoadIcon(0, IDI_QUESTION);
5 : IconData.hIcon := Application.Icon.Handle;
end;
inc(IconCount);
if IconCount > 5 then
IconCount := 0;
Application.Title := TimeToStr(Now);
StrPCopy(IconData.szTip, Application.Title);
Shell_NotifyIcon(NIM_MODIFY, @IconData);
end;
begin
ShowWindow(Application.Handle, SW_HIDE);
end.
Joe C. Hecht
http://home1.gte.net/joehecht/index.htm
Danke Joe, ich habe mit dem suchbegriff ein Tool gefunden.
Gruss Michael
[Bei dieser Antwort wurde das Vollzitat nachträglich automatisiert entfernt]