S
shijiesun3
Unregistered / Unconfirmed
GUEST, unregistred user!
找到了一段代码
//工程文件代码
Application.Initialize;
Application.CreateForm(TForm1,Form1);
Application.CreateForm(TForm2,Form2);
Application.ShowMainForm:=False;
Application.OnMinimize:=Form1.FormMin;
Application.Run;
//主窗体程序代码
procedure TForm1.IconClick(var Msg:TMessage);
var Point:TPoint;
begin
if msg.LParam=WM_LBUTTONDOWN then
begin
if Form2.Visible=False then
begin
Form2.WindowState:=wsNormal;
Form2.Show;
end
Else
Form2.Hide;
end
else if msg.LParam=WM_RBUTTONDOWN then
begin
GetCursorPos(Point);
PopupMenu1.Popup(point.X,point.Y);
end;
end;
//在主窗体创建时安装托盘图标
procedure TForm1.FormCreate(Sender:TObject);
var
pIcon:TNotifyIcondata;
begin
pIcon.Wnd:=Handle;
pIcon.uID:=10;
pIcon.uFlags:=NIF_ICON or NIF_MESSAGE or NIF_TIP;
pIcon.uCallbackMessage:=CM_Icon.Handle;
pIcon.szTip:='托盘程序';
Shell_NotifyIcon(NIM_ADD,@pIcon);
end;
//在主窗体关闭时,卸载托盘图标
procedure TForm1.FormClose(Sender:TObject;var Action:TCloseAction);
var
pIcon:TNotifyIcondata;
begin
pIcon.Wnd:=Handle;
pIcon.uID:=10;
pIcon.hIcon:=Application.Icon.Handle;
Shell_NotifyIcon(NIM_Delete,@pIcon);
end;
自定义过程,应用程序最小化时执行该过程
procedure TForm1.FormMin(Sender:TObject);
begin
Hide;
end;
那个参数代表程序图标?
//工程文件代码
Application.Initialize;
Application.CreateForm(TForm1,Form1);
Application.CreateForm(TForm2,Form2);
Application.ShowMainForm:=False;
Application.OnMinimize:=Form1.FormMin;
Application.Run;
//主窗体程序代码
procedure TForm1.IconClick(var Msg:TMessage);
var Point:TPoint;
begin
if msg.LParam=WM_LBUTTONDOWN then
begin
if Form2.Visible=False then
begin
Form2.WindowState:=wsNormal;
Form2.Show;
end
Else
Form2.Hide;
end
else if msg.LParam=WM_RBUTTONDOWN then
begin
GetCursorPos(Point);
PopupMenu1.Popup(point.X,point.Y);
end;
end;
//在主窗体创建时安装托盘图标
procedure TForm1.FormCreate(Sender:TObject);
var
pIcon:TNotifyIcondata;
begin
pIcon.Wnd:=Handle;
pIcon.uID:=10;
pIcon.uFlags:=NIF_ICON or NIF_MESSAGE or NIF_TIP;
pIcon.uCallbackMessage:=CM_Icon.Handle;
pIcon.szTip:='托盘程序';
Shell_NotifyIcon(NIM_ADD,@pIcon);
end;
//在主窗体关闭时,卸载托盘图标
procedure TForm1.FormClose(Sender:TObject;var Action:TCloseAction);
var
pIcon:TNotifyIcondata;
begin
pIcon.Wnd:=Handle;
pIcon.uID:=10;
pIcon.hIcon:=Application.Icon.Handle;
Shell_NotifyIcon(NIM_Delete,@pIcon);
end;
自定义过程,应用程序最小化时执行该过程
procedure TForm1.FormMin(Sender:TObject);
begin
Hide;
end;
那个参数代表程序图标?