请各位高手帮忙!
解决方案 »
- 关于File not found,求救...
- 如何判断有计算机与自己计算机连接??
- 前面加下划线的是什么类型的变量
- 全局变量问题!
- 请问如何在richedit中屏蔽Backspace键(不是空格,是删除键)?
- 妈的,奋战了足足两个星期,才从五条绿三角裤变为一条红三角裤,不过,还是高兴,兄弟姐妹们快来接分!!!!
- Rewrite(var F: File [; Recsize: Word ] );
- 求一困扰我五年的高难度算法
- ■保存贴子的方法■修改了.xsl文件,浏览更整洁
- 如何做象Foxmail中的TreeView+密码
- delphi内部使用什么编码?
- 高手救命阿,谁知道DELPHI里的EOleException是怎么使用的?
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, AppEvnts, ShellAPI;
const
SERVER_TRAY_MESSAGE = WM_USER + 100;type
TForm1 = class(TForm)
ApplicationEvents1: TApplicationEvents;
procedure ApplicationEvents1Minimize(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
ServerTrayIconData : TNotifyIconData; procedure ServerTrayMessage(var Message: TMessage); message SERVER_TRAY_MESSAGE;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}{ TForm1 }procedure TForm1.ServerTrayMessage(var Message: TMessage);
begin
if Message.Msg = SERVER_TRAY_MESSAGE then
begin
case Message.LParam of
WM_LBUTTONDBLCLK:
begin
if IsIconic(Application.Handle) then begin
ShowWindow(Application.Handle, SW_NORMAL);
SetForegroundWindow(Application.Handle);
end;
end;
end;
end;
end;procedure TForm1.ApplicationEvents1Minimize(Sender: TObject);
begin
ShowWindow(Application.Handle, SW_HIDE);
end;procedure TForm1.FormActivate(Sender: TObject);
begin
Application.Minimize;
end;procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Shell_NotifyIcon(NIM_DELETE, @ServerTrayIconData);
end;procedure TForm1.FormCreate(Sender: TObject);
begin
{ 托盘 }
ServerTrayIconData.cbSize := SizeOf(ServerTrayIconData);
ServerTrayIconData.uFlags := NIF_ICON or NIF_TIP or NIF_MESSAGE;
ServerTrayIconData.uID := UINT(Self);
ServerTrayIconData.Wnd := Handle;
ServerTrayIconData.hIcon := Application.Icon.Handle;
ServerTrayIconData.szTip := '简单局域网聊天程序服务器端';
ServerTrayIconData.uCallbackMessage := SERVER_TRAY_MESSAGE;
Shell_NotifyIcon(NIM_ADD, @ServerTrayIconData);
end;end.