Home > Back-end >  How to need to display the form of minimization to the taskbar tray area?
How to need to display the form of minimization to the taskbar tray area?

Time:09-29

I think the Timer1 components after reaching time, show window "event", the "event" window, I want to make it:
When Timer1 components after reaching time, show flashing icon in the taskbar tray area, and then double-click the flashing icon, open the window "event", from a friend I download for an example, according to the example, after doing now just do Click SpeedButton1. After Click, displayed in the task bar, but there are some not understand place and a few problems, the code is as follows:

(I a rookie, the unit will have to be all the code is posted, you help me take a look at how to rewrite)

The unit Unit1;

Interface

USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls;

Const WM_NID=WM_User + 1000;

Type
TForm1=class (TForm)
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
Label1: TLabel;
Procedure FormCloseQuery (Sender: TObject; Var CanClose: Boolean);
Procedure N1Click (Sender: TObject);
Procedure FormShow (Sender: TObject);
Private
{Private declarations}
Procedure WMNID (var MSG: TMessage); The message WM_NID;
Public
{Public declarations}
end;

Var
Form1: TForm1;

Implementation

USES ShellAPI;

Var
NotifyIcon: TNotifyIconData;

{$R *. DFM}

Procedure TForm1. WMNID (var MSG: TMessage);
Var
CursorPos: TPoint;
The begin
If the MSG. LParam=WM_RBUTTONDOWN then//in the tray area after clicking left key
The begin
The GetCursorPos (CursorPos);
If IsIconIc (Application. Handle) then
The SetForegroundWindow (Application. Handle)
The else
Application. BringToFront;

Application. ProcessMessages;
PopupMenu1. Popup (CursorPos. X, CursorPos. Y);
PostMessage (Application. MainForm. Handle, WM_NULL, 0, 0).
end;
end;

Procedure TForm1. FormCloseQuery (Sender: TObject; Var CanClose: Boolean);
The begin
Shell_NotifyIcon (NIM_DELETE. @ NotifyIcon)//remove tray icon
end;

Procedure TForm1. N1Click (Sender: TObject);
The begin
The close;
end;

Procedure TForm1. FormShow (Sender: TObject);
The begin
With NotifyIcon do
The begin
The cbSize:=SizeOf (TNotifyIconData);
Wnd:=Handle;
: uID=1;
UFlags:=NIF_ICON the or NIF_MESSAGE or NIF_TIP;
UCallBackMessage:=WM_NID;
HIcon:=Application Icon. Handle;
SzTip:='tray program;
end;
Shell_NotifyIcon (NIM_ADD, @ NotifyIcon);//display icon in
end;

End.

Questions as follows:

1, "reminders", after the establishment in the dynamic window on the desktop and the taskbar tray display area, how to make it after the construction of the dynamic, don't show the form, directly into the tray area?

2, after the display to the taskbar tray area, icon does not flicker, how to realize the flashing? Just like QQ message pop-up,

3, Const WM_NID=WM_User + 1; After this sentence, some examples in WM_User + 1, after some examples in WM_User + 1000, what is the difference between the 1 and 1000? Why are you +? Don't + line not line?

IsIconIc under 4, I checked on the Internet, online said this function is used to determine whether the window minimized, minimize, it returns non-zero, not minimized, it returns "0", Then the IF IsIconIc (Application. Handle) Then after judgment, the result is "minimize" or "normal display"?

5, SetForegroundWindow (Form2. Handle) this sentence is "activate Form2"?

6, Application BringToFront this sentence is the window "top"?

7, the PostMessage (Form2. Handle, WM_NULL, 0, 0). This sentence is what meaning, don't understand, look forward to answer,

8, why not call WMNID Form2 will be on the taskbar tray area,

My points is not much, can't give high marks, but also looked each prawn don't suspicion points less, can be glad, solution I wonder!!!!!

CodePudding user response:

Icon flash, two ICONS should be exchange, namely an empty icon, and then a practical icon, the switch can achieve animation effects, in addition this is a ready-made controls, D2007, Delphi bring called TrayIcon, before there is a third party, so seemingly TrayIcon this name!

CodePudding user response:

Check out, also need to learn this feature!

CodePudding user response:

I now have solved the first problem - "event", after the establishment in the dynamic window on the desktop and the taskbar tray display area, how to make it after the construction of the dynamic, don't show the form, directly into the tray area?

CodePudding user response:

As to the problem of icon flash, I have 2 kinds of scheme:
1, 2, a different icon, use IF statements, flicker frequency and QQ window is similar, but the disadvantage is that two different icon, not one icon is empty, is also a patterned,

2 same icon, add a NotifyIcon, then through calculation of the time to implement the flashing, have been implemented, but the disadvantage is that flicker frequency is slow, short of QQ window pops that effect,

Excuse me: how to be a empty icon? Through what software? Who can provide me with an empty icon? In addition, in the task bar icon should be 32 pixels icon, rather than 16 pixels? Because 16 pixels as small than the other in the task bar icon,

CodePudding user response:

Using TrayBarIconu unit (TrayIcon), make it a tray program,

CodePudding user response:

TRzTrayIcon coupled with this is ok, is very simple,
  • Related